Class: Trailblazer::Finder::Configuration
- Inherits:
-
Object
- Object
- Trailblazer::Finder::Configuration
- Defined in:
- lib/trailblazer/finder/dsl.rb
Instance Attribute Summary collapse
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
- #adapter ⇒ Object
- #adapter=(value) ⇒ Object
-
#clone ⇒ Object
Clone the configuration by copying the state.
-
#entity ⇒ Object
Accessors that delegate to the state.
- #entity=(value) ⇒ Object
- #filters ⇒ Object
- #filters=(value) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #paginator ⇒ Object
- #paginator=(value) ⇒ Object
- #paging ⇒ Object
- #paging=(value) ⇒ Object
- #properties ⇒ Object
- #properties=(value) ⇒ Object
- #sorting ⇒ Object
- #sorting=(value) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/trailblazer/finder/dsl.rb', line 6 def initialize @state = Trailblazer::Declarative::State( entity: [nil, {}], paging: [{}, {}], properties: [{}, {}], sorting: [{}, {}], filters: [{}, {}], adapter: ["Basic", {}], paginator: [nil, {}] ) end |
Instance Attribute Details
#state ⇒ Object (readonly)
Returns the value of attribute state.
4 5 6 |
# File 'lib/trailblazer/finder/dsl.rb', line 4 def state @state end |
Instance Method Details
#adapter ⇒ Object
59 60 61 |
# File 'lib/trailblazer/finder/dsl.rb', line 59 def adapter state.get(:adapter) end |
#adapter=(value) ⇒ Object
63 64 65 |
# File 'lib/trailblazer/finder/dsl.rb', line 63 def adapter=(value) state.set!(:adapter, value) end |
#clone ⇒ Object
Clone the configuration by copying the state
76 77 78 79 80 |
# File 'lib/trailblazer/finder/dsl.rb', line 76 def clone new_config = Configuration.new new_config.instance_variable_set(:@state, @state.copy) new_config end |
#entity ⇒ Object
Accessors that delegate to the state
19 20 21 |
# File 'lib/trailblazer/finder/dsl.rb', line 19 def entity state.get(:entity) end |
#entity=(value) ⇒ Object
23 24 25 |
# File 'lib/trailblazer/finder/dsl.rb', line 23 def entity=(value) state.set!(:entity, value) end |
#filters ⇒ Object
51 52 53 |
# File 'lib/trailblazer/finder/dsl.rb', line 51 def filters state.get(:filters) end |
#filters=(value) ⇒ Object
55 56 57 |
# File 'lib/trailblazer/finder/dsl.rb', line 55 def filters=(value) state.set!(:filters, value) end |
#paginator ⇒ Object
67 68 69 |
# File 'lib/trailblazer/finder/dsl.rb', line 67 def paginator state.get(:paginator) end |
#paginator=(value) ⇒ Object
71 72 73 |
# File 'lib/trailblazer/finder/dsl.rb', line 71 def paginator=(value) state.set!(:paginator, value) end |
#paging ⇒ Object
27 28 29 |
# File 'lib/trailblazer/finder/dsl.rb', line 27 def paging state.get(:paging) end |
#paging=(value) ⇒ Object
31 32 33 |
# File 'lib/trailblazer/finder/dsl.rb', line 31 def paging=(value) state.set!(:paging, value) end |
#properties ⇒ Object
35 36 37 |
# File 'lib/trailblazer/finder/dsl.rb', line 35 def properties state.get(:properties) end |
#properties=(value) ⇒ Object
39 40 41 |
# File 'lib/trailblazer/finder/dsl.rb', line 39 def properties=(value) state.set!(:properties, value) end |
#sorting ⇒ Object
43 44 45 |
# File 'lib/trailblazer/finder/dsl.rb', line 43 def sorting state.get(:sorting) end |
#sorting=(value) ⇒ Object
47 48 49 |
# File 'lib/trailblazer/finder/dsl.rb', line 47 def sorting=(value) state.set!(:sorting, value) end |