Module: EntityStore::Controls::EntityStore
- Defined in:
- lib/entity_store/controls/entity_store.rb
Defined Under Namespace
Modules: Category, NoCategory
Constant Summary collapse
- Example =
self.example_class
Class Method Summary collapse
- .example(category: nil, entity_class: nil, projection_class: nil, reader_class: nil, snapshot_class: nil, snapshot_interval: nil, reader_batch_size: nil, specifier: nil) ⇒ Object
- .example_class(category: nil, entity_class: nil, projection_class: nil, reader_class: nil, snapshot_class: nil, snapshot_interval: nil, reader_batch_size: nil, specifier: nil) ⇒ Object
Class Method Details
.example(category: nil, entity_class: nil, projection_class: nil, reader_class: nil, snapshot_class: nil, snapshot_interval: nil, reader_batch_size: nil, specifier: nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/entity_store/controls/entity_store.rb', line 4 def self.example(category: nil, entity_class: nil, projection_class: nil, reader_class: nil, snapshot_class: nil, snapshot_interval: nil, reader_batch_size: nil, specifier: nil) if category.nil? && entity_class.nil? && projection_class.nil? && reader_class.nil? && snapshot_class.nil? && snapshot_interval.nil? && reader_batch_size.nil? && specifier.nil? store_class = Example else store_class = example_class(category: category, entity_class: entity_class, projection_class: projection_class, reader_class: reader_class, snapshot_class: snapshot_class, snapshot_interval: snapshot_interval, reader_batch_size: reader_batch_size, specifier: specifier) end instance = store_class.build instance end |
.example_class(category: nil, entity_class: nil, projection_class: nil, reader_class: nil, snapshot_class: nil, snapshot_interval: nil, reader_batch_size: nil, specifier: nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/entity_store/controls/entity_store.rb', line 15 def self.example_class(category: nil, entity_class: nil, projection_class: nil, reader_class: nil, snapshot_class: nil, snapshot_interval: nil, reader_batch_size: nil, specifier: nil) if category == :none category = nil else category ||= Controls::Category.example end if entity_class == :none entity_class = nil else entity_class ||= Controls::Entity::Example end if projection_class == :none projection_class = nil else projection_class ||= Controls::Projection::Example end if reader_class == :none reader_class = nil else reader_class ||= Controls::Reader::Example end if reader_batch_size == :none reader_batch_size = nil else reader_batch_size ||= Controls::Reader::BatchSize.example end if specifier == :none specifier = nil else specifier ||= Controls::Specifier.example end Class.new do include ::EntityStore category category entity entity_class projection projection_class reader reader_class, batch_size: reader_batch_size unless snapshot_class.nil? snapshot snapshot_class, interval: snapshot_interval end unless specifier.nil? specifier specifier end end end |