Class: Katalyst::Tables::Collection::Reducers::Stack
- Inherits:
-
Object
- Object
- Katalyst::Tables::Collection::Reducers::Stack
- Defined in:
- app/models/concerns/katalyst/tables/collection/reducers.rb
Overview
:nodoc:
Instance Method Summary collapse
- #build(&block) ⇒ Object
- #index(klass) ⇒ Object
-
#initialize ⇒ Stack
constructor
A new instance of Stack.
- #initialize_dup(other) ⇒ Object
- #insert(other, klass) ⇒ Object
- #use(klass) ⇒ Object
Constructor Details
#initialize ⇒ Stack
Returns a new instance of Stack.
27 28 29 |
# File 'app/models/concerns/katalyst/tables/collection/reducers.rb', line 27 def initialize @stack = [] end |
Instance Method Details
#build(&block) ⇒ Object
47 48 49 50 51 |
# File 'app/models/concerns/katalyst/tables/collection/reducers.rb', line 47 def build(&block) @stack.freeze.reduce(block) do |app, reducer| reducer.build(app) end end |
#index(klass) ⇒ Object
43 44 45 |
# File 'app/models/concerns/katalyst/tables/collection/reducers.rb', line 43 def index(klass) @stack.index(Reducer.new(klass)) end |
#initialize_dup(other) ⇒ Object
31 32 33 |
# File 'app/models/concerns/katalyst/tables/collection/reducers.rb', line 31 def initialize_dup(other) @stack = other.instance_variable_get(:@stack).dup end |