Class: SimpleHdGraph::ResourceNode
- Inherits:
-
Node
- Object
- Node
- SimpleHdGraph::ResourceNode
show all
- Defined in:
- lib/simple-hd-graph/resource.rb
Constant Summary
Constants inherited
from Node
Node::CAMELIZE_SEPARATOR
Instance Method Summary
collapse
Methods inherited from Node
#camelize, #initialize, #load, required
Instance Method Details
#alias ⇒ String
17
18
19
|
# File 'lib/simple-hd-graph/resource.rb', line 17
def alias
@content.keys.first.to_s.freeze
end
|
#content ⇒ Hash
40
41
42
43
44
|
# File 'lib/simple-hd-graph/resource.rb', line 40
def content
@content.values.first.select { |key, value| key != "has"
}
end
|
#context ⇒ String
33
34
35
|
# File 'lib/simple-hd-graph/resource.rb', line 33
def context
@context[:id].freeze
end
|
#has ⇒ Array
49
50
51
|
# File 'lib/simple-hd-graph/resource.rb', line 49
def has
@content.values.first["has"]
end
|
#id ⇒ String
24
25
26
27
28
|
# File 'lib/simple-hd-graph/resource.rb', line 24
def id
id = camelize(context)
id[0] = id[0].downcase
[id, camelize(self.alias)].join("").freeze
end
|
#load_with_context(context, struct) ⇒ Object
9
10
11
12
|
# File 'lib/simple-hd-graph/resource.rb', line 9
def load_with_context(context, struct)
@context = context
load(struct)
end
|