Class: ThinkingSphinx::ActiveRecord::Column
- Inherits:
-
Object
- Object
- ThinkingSphinx::ActiveRecord::Column
show all
- Defined in:
- lib/thinking_sphinx/active_record/column.rb
Instance Method Summary
collapse
Constructor Details
#initialize(*stack) ⇒ Column
Returns a new instance of Column.
4
5
6
7
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 4
def initialize(*stack)
@stack = stack
@name = stack.pop
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
39
40
41
42
43
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 39
def method_missing(method, *args, &block)
@stack << @name
@name = method
self
end
|
Instance Method Details
#__name ⇒ Object
9
10
11
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 9
def __name
@name
end
|
#__path ⇒ Object
13
14
15
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 13
def __path
@stack + [@name]
end
|
#__replace(stack, replacements) ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 17
def __replace(stack, replacements)
return [self] if string? || __stack[0..stack.length-1] != stack
replacements.collect { |replacement|
self.class.new *(replacement + __stack[stack.length..-1]), __name
}
end
|
#__stack ⇒ Object
25
26
27
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 25
def __stack
@stack
end
|
#string? ⇒ Boolean
29
30
31
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 29
def string?
__name.is_a?(String)
end
|
#to_ary ⇒ Object
33
34
35
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 33
def to_ary
[self]
end
|