Class: Sunspot::Query::Sort::FunctionComp
- Inherits:
-
Object
- Object
- Sunspot::Query::Sort::FunctionComp
- Defined in:
- lib/sunspot/query/sort.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#function ⇒ Object
Returns the value of attribute function.
Instance Method Summary collapse
-
#initialize(setup, args) ⇒ FunctionComp
constructor
A new instance of FunctionComp.
- #to_s ⇒ Object
Constructor Details
#initialize(setup, args) ⇒ FunctionComp
Returns a new instance of FunctionComp.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/sunspot/query/sort.rb', line 134 def initialize(setup,args) @function=args.shift @fields = [] args.each do |argument| case argument.class.name when "Array" @fields<< FunctionComp.new(setup,argument) when "Symbol" @fields<< setup.field(argument).indexed_name else @fields<< argument end end end |
Instance Attribute Details
#fields ⇒ Object
Returns the value of attribute fields.
133 134 135 |
# File 'lib/sunspot/query/sort.rb', line 133 def fields @fields end |
#function ⇒ Object
Returns the value of attribute function.
133 134 135 |
# File 'lib/sunspot/query/sort.rb', line 133 def function @function end |
Instance Method Details
#to_s ⇒ Object
148 149 150 |
# File 'lib/sunspot/query/sort.rb', line 148 def to_s "#{function}(#{fields.map(&:to_s).join(",")})" end |