Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Its: allowing params feature #786

Closed
Closed
@ghost

Description

"its" could allow easily the use of methods with parameters like its("phone_numbers[0]").

# I think this piece of code could be changed from:

def its(attribute, &block)
  ..
      let(:__its_subject) do
        attribute_chain = attribute.to_s.split('.')
          attribute_chain.inject(subject) do |inner_subject, attr|
            inner_subject.send(attr)
          end
        end
      end
   ..

# to this, to allow params and method chaining
..
  let(:__its_subject) do
    subject.instance_eval(attribute.to_s)
  end
..

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions