Class: Proc::Conditions::Attribute

Inherits:
BlankSlate show all
Defined in:
lib/data_mapper/support/proc.rb

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ Attribute

Returns a new instance of Attribute.



32
33
34
35
36
# File 'lib/data_mapper/support/proc.rb', line 32

def initialize(message)
  @message = message
  @args = nil
  @operator = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/data_mapper/support/proc.rb', line 38

def method_missing(sym, *args)
  op = case sym
    when :==, :===, :in then :eql
    when :=~ then :like
    when :"<=>" then :not
    when :< then :lt
    when :<= then :lte
    when :> then :gt
    when :>= then :gte
    else sym
  end
  
  @operator = Symbol::Operator.new(@message, op)
  @args = args
end

Instance Method Details

#__args__Object



58
59
60
# File 'lib/data_mapper/support/proc.rb', line 58

def __args__
  @args
end

#__message__Object



62
63
64
# File 'lib/data_mapper/support/proc.rb', line 62

def __message__
  @message
end

#__operator__Object



54
55
56
# File 'lib/data_mapper/support/proc.rb', line 54

def __operator__
  @operator
end