Class: YADM::Criteria::Argument

Inherits:
Object
  • Object
show all
Defined in:
lib/yadm/criteria/argument.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(group, index) ⇒ Argument

Returns a new instance of Argument.



6
7
8
9
# File 'lib/yadm/criteria/argument.rb', line 6

def initialize(group, index)
  @group = group
  @index = index
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



4
5
6
# File 'lib/yadm/criteria/argument.rb', line 4

def group
  @group
end

#indexObject (readonly)

Returns the value of attribute index.



4
5
6
# File 'lib/yadm/criteria/argument.rb', line 4

def index
  @index
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
14
15
# File 'lib/yadm/criteria/argument.rb', line 11

def ==(other)
  %i(group index).all? do |method|
    other.respond_to?(method) && send(method) == other.send(method)
  end
end

#fetch_from(values) ⇒ Object



17
18
19
# File 'lib/yadm/criteria/argument.rb', line 17

def fetch_from(values)
  values[group][index]
end