Class: Dendrite::Generators::Base
- Inherits:
-
Object
- Object
- Dendrite::Generators::Base
- Defined in:
- lib/dendrite/generators/base.rb
Instance Attribute Summary collapse
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#services ⇒ Object
readonly
Returns the value of attribute services.
Instance Method Summary collapse
-
#initialize(graph:, service_names:) ⇒ Base
constructor
A new instance of Base.
- #to_h ⇒ Object
- #to_json ⇒ Object
- #to_yaml ⇒ Object
Constructor Details
#initialize(graph:, service_names:) ⇒ Base
Returns a new instance of Base.
6 7 8 9 10 11 |
# File 'lib/dendrite/generators/base.rb', line 6 def initialize(graph:, service_names:) @graph = graph @services = graph.services .select { |service_name, service| service_names.include?(service_name) } .collect { |_, service| service } end |
Instance Attribute Details
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
4 5 6 |
# File 'lib/dendrite/generators/base.rb', line 4 def graph @graph end |
#services ⇒ Object (readonly)
Returns the value of attribute services.
4 5 6 |
# File 'lib/dendrite/generators/base.rb', line 4 def services @services end |
Instance Method Details
#to_h ⇒ Object
13 14 15 |
# File 'lib/dendrite/generators/base.rb', line 13 def to_h raise NotImplementedError end |
#to_json ⇒ Object
21 22 23 |
# File 'lib/dendrite/generators/base.rb', line 21 def to_json self.to_h.to_json end |
#to_yaml ⇒ Object
17 18 19 |
# File 'lib/dendrite/generators/base.rb', line 17 def to_yaml self.to_h.deep_stringify_keys.to_yaml end |