Class: Datapathy::Query::Condition

Inherits:
ActiveSupport::BasicObject
Defined in:
lib/datapathy/query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation, *arguments, &block) ⇒ Condition

Returns a new instance of Condition.



118
119
120
121
122
# File 'lib/datapathy/query.rb', line 118

def initialize(operation, *arguments, &block)
  @operation = operation
  @arguments = arguments unless arguments.empty?
  @block = block if block
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &blk) ⇒ Object



124
125
126
# File 'lib/datapathy/query.rb', line 124

def method_missing(method_name, *args, &blk)
  @then = Condition.new(method_name, *args, &blk)
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



116
117
118
# File 'lib/datapathy/query.rb', line 116

def arguments
  @arguments
end

#blockObject

Returns the value of attribute block.



116
117
118
# File 'lib/datapathy/query.rb', line 116

def block
  @block
end

#operationObject

Returns the value of attribute operation.



116
117
118
# File 'lib/datapathy/query.rb', line 116

def operation
  @operation
end

#thenObject (readonly)

Returns the value of attribute then.



115
116
117
# File 'lib/datapathy/query.rb', line 115

def then
  @then
end

Instance Method Details

#inspectObject



132
133
134
135
136
137
# File 'lib/datapathy/query.rb', line 132

def inspect
  string = operation.to_s
  string << "#{@arguments.inspect}" unless @arguments.nil?
  string << " #{@then.inspect}" if @then
  string
end

#respond_to?(arg) ⇒ Boolean

Returns:

  • (Boolean)


128
129
130
# File 'lib/datapathy/query.rb', line 128

def respond_to?(arg)
  false
end