Class: Alchemrest::Data::Graph
- Inherits:
-
Object
- Object
- Alchemrest::Data::Graph
- Defined in:
- lib/alchemrest/data/graph.rb
Overview
A simple data structure to hold a graph of all the objects in a schema.
Instance Method Summary collapse
- #children ⇒ Object
-
#initialize(type:, sub_graphs: nil, fields: nil) ⇒ Graph
constructor
A new instance of Graph.
Constructor Details
#initialize(type:, sub_graphs: nil, fields: nil) ⇒ Graph
Returns a new instance of Graph.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/alchemrest/data/graph.rb', line 9 def initialize(type:, sub_graphs: nil, fields: nil) unless type < Data raise ArgumentError, "Graph types must be branching Alchemrest::Data class" end unless sub_graphs.nil? || sub_graph_hash_has_correct_types?(sub_graphs:) raise ArgumentError, "sub_graphs must be a hash of graphs" end unless fields.nil? || fields_hash_has_correct_types?(fields:) raise ArgumentError, "fields must be a hash of fields" end @type = type @fields = fields @sub_graphs = sub_graphs end |
Instance Method Details
#children ⇒ Object
25 26 27 |
# File 'lib/alchemrest/data/graph.rb', line 25 def children sub_graphs end |