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.
2
3
4
5
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 2
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
37
38
39
40
41
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 37
def method_missing(method, *args, &block)
@stack << @name
@name = method
self
end
|
Instance Method Details
#__name ⇒ Object
7
8
9
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 7
def __name
@name
end
|
#__path ⇒ Object
11
12
13
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 11
def __path
@stack + [@name]
end
|
#__replace(stack, replacements) ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 15
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
23
24
25
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 23
def __stack
@stack
end
|
#string? ⇒ Boolean
27
28
29
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 27
def string?
__name.is_a?(String)
end
|
#to_ary ⇒ Object
31
32
33
|
# File 'lib/thinking_sphinx/active_record/column.rb', line 31
def to_ary
[self]
end
|