Class: ReceiveAny

Inherits:
BlankSlate show all
Defined in:
lib/receive_any.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier, builder) ⇒ ReceiveAny

Returns a new instance of ReceiveAny.



4
5
6
7
# File 'lib/receive_any.rb', line 4

def initialize(identifier, builder)
  @to_sql = identifier.to_s
  @builder = builder
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args) ⇒ Object

Raises:

  • (ArgumentError)


59
60
61
62
63
# File 'lib/receive_any.rb', line 59

def method_missing(sym, *args)
  raise ArgumentError.new("#{self.to_sql} is not specified as a table in your from statement") unless @builder.tables.include?(self.to_sql.to_sym)
  @to_sql << ".#{sym.to_s}"
  self
end

Instance Attribute Details

#builderObject (readonly)

Returns the value of attribute builder.



2
3
4
# File 'lib/receive_any.rb', line 2

def builder
  @builder
end

#to_sqlObject (readonly)

Returns the value of attribute to_sql.



2
3
4
# File 'lib/receive_any.rb', line 2

def to_sql
  @to_sql
end

Instance Method Details

#equal(arg) ⇒ Object Also known as: ==



9
10
11
# File 'lib/receive_any.rb', line 9

def equal(arg)
  builder.equal self, arg
end

#greater_than(arg) ⇒ Object Also known as: >



29
30
31
# File 'lib/receive_any.rb', line 29

def greater_than(arg)
  builder.greater_than self, arg
end

#greater_than_or_equal(arg) ⇒ Object Also known as: >=



34
35
36
# File 'lib/receive_any.rb', line 34

def greater_than_or_equal(arg)
  builder.greater_than_or_equal self, arg
end

#is_in(arg) ⇒ Object Also known as: >>



39
40
41
# File 'lib/receive_any.rb', line 39

def is_in(arg)
  builder.is_in self, arg
end

#is_not_in(arg) ⇒ Object Also known as: <<



44
45
46
# File 'lib/receive_any.rb', line 44

def is_not_in(arg)
  builder.is_not_in self, arg
end

#is_not_null(arg = nil) ⇒ Object Also known as: ^



54
55
56
# File 'lib/receive_any.rb', line 54

def is_not_null(arg=nil)
  builder.is_not_null self
end

#less_than(arg) ⇒ Object Also known as: <



19
20
21
# File 'lib/receive_any.rb', line 19

def less_than(arg)
  builder.less_than self, arg
end

#less_than_or_equal(arg) ⇒ Object Also known as: <=



24
25
26
# File 'lib/receive_any.rb', line 24

def less_than_or_equal(arg)
  builder.less_than_or_equal self, arg
end

#like(arg) ⇒ Object Also known as: =~



49
50
51
# File 'lib/receive_any.rb', line 49

def like(arg)
  builder.like self, arg
end

#not_equal(arg) ⇒ Object Also known as: <=>



14
15
16
# File 'lib/receive_any.rb', line 14

def not_equal(arg)
  builder.not_equal self, arg
end