Class: HecksDomain::Parser::Aggregate
- Inherits:
-
Object
- Object
- HecksDomain::Parser::Aggregate
- Defined in:
- lib/hecks/domain/parser/aggregate.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#domain_objects ⇒ Object
readonly
Returns the value of attribute domain_objects.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #binding ⇒ Object
- #entity(name, &block) ⇒ Object
- #file_name ⇒ Object
- #folder_name ⇒ Object
-
#initialize(name, domain, &block) ⇒ Aggregate
constructor
A new instance of Aggregate.
- #root(name, &block) ⇒ Object
- #value(name, &block) ⇒ Object
Constructor Details
#initialize(name, domain, &block) ⇒ Aggregate
Returns a new instance of Aggregate.
6 7 8 9 10 11 12 13 |
# File 'lib/hecks/domain/parser/aggregate.rb', line 6 def initialize(name, domain, &block) @name = name @entities = [] @value_objects = [] @domain = domain instance_eval(&block) @domain_objects = @entities + @value_objects end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
4 5 6 |
# File 'lib/hecks/domain/parser/aggregate.rb', line 4 def domain @domain end |
#domain_objects ⇒ Object (readonly)
Returns the value of attribute domain_objects.
4 5 6 |
# File 'lib/hecks/domain/parser/aggregate.rb', line 4 def domain_objects @domain_objects end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/hecks/domain/parser/aggregate.rb', line 4 def name @name end |
Instance Method Details
#binding ⇒ Object
39 40 41 |
# File 'lib/hecks/domain/parser/aggregate.rb', line 39 def binding super end |
#entity(name, &block) ⇒ Object
15 16 17 18 19 |
# File 'lib/hecks/domain/parser/aggregate.rb', line 15 def entity(name, &block) Entity.new(name, self, &block).tap do |entity| @entities << entity end end |
#file_name ⇒ Object
21 22 23 |
# File 'lib/hecks/domain/parser/aggregate.rb', line 21 def file_name folder_name + '.rb' end |
#folder_name ⇒ Object
25 26 27 |
# File 'lib/hecks/domain/parser/aggregate.rb', line 25 def folder_name name.to_s.underscore end |
#root(name, &block) ⇒ Object
29 30 31 32 33 |
# File 'lib/hecks/domain/parser/aggregate.rb', line 29 def root(name, &block) @root = Root.new(name, self, &block).tap do |root| @entities << root end end |
#value(name, &block) ⇒ Object
35 36 37 |
# File 'lib/hecks/domain/parser/aggregate.rb', line 35 def value(name, &block) @value_objects << ValueObject.new(name, self, &block) end |