Class: Almicube::Selector::MethodSelector
- Defined in:
- lib/almicube/selector/method_selector.rb
Instance Attribute Summary collapse
-
#accessor ⇒ Object
readonly
Returns the value of attribute accessor.
-
#counter ⇒ Object
readonly
Returns the value of attribute counter.
Attributes inherited from Base
Attributes included from Cog
Instance Method Summary collapse
- #count ⇒ Object
-
#initialize(options = {}) ⇒ MethodSelector
constructor
A new instance of MethodSelector.
- #records ⇒ Object
- #valid? ⇒ Boolean
Methods inherited from Base
#before_aggregate, #data_provider?, #interstore, #label
Methods included from Cog
#active?, #after_aggregate, #before_aggregate
Constructor Details
#initialize(options = {}) ⇒ MethodSelector
Returns a new instance of MethodSelector.
6 7 8 9 10 11 12 13 |
# File 'lib/almicube/selector/method_selector.rb', line 6 def initialize(={}) super() @accessor = [:accessor] || :all @counter = [:counter] || :count raise "invalid options" unless valid? end |
Instance Attribute Details
#accessor ⇒ Object (readonly)
Returns the value of attribute accessor.
4 5 6 |
# File 'lib/almicube/selector/method_selector.rb', line 4 def accessor @accessor end |
#counter ⇒ Object (readonly)
Returns the value of attribute counter.
4 5 6 |
# File 'lib/almicube/selector/method_selector.rb', line 4 def counter @counter end |
Instance Method Details
#count ⇒ Object
19 20 21 |
# File 'lib/almicube/selector/method_selector.rb', line 19 def count class_name.send(counter) end |
#records ⇒ Object
15 16 17 |
# File 'lib/almicube/selector/method_selector.rb', line 15 def records class_name.send(accessor) end |
#valid? ⇒ Boolean
23 24 25 |
# File 'lib/almicube/selector/method_selector.rb', line 23 def valid? validate_accessor end |