Class: YADM::Criteria::Expression

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(receiver, method_name, arguments) ⇒ Expression

Returns a new instance of Expression.



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

def initialize(receiver, method_name, arguments)
  @receiver    = receiver
  @method_name = method_name
  @arguments   = arguments
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



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

def arguments
  @arguments
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



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

def method_name
  @method_name
end

#receiverObject (readonly)

Returns the value of attribute receiver.



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

def receiver
  @receiver
end

Instance Method Details

#==(other) ⇒ Object



12
13
14
15
16
# File 'lib/yadm/criteria/expression.rb', line 12

def ==(other)
  %i(receiver method_name arguments).all? do |method|
    other.respond_to?(method) && send(method) == other.send(method)
  end
end