Class: Middleman::Dependencies::DataCollectionPathVertex
- Inherits:
-
Vertex
- Object
- Vertex
- Middleman::Dependencies::DataCollectionPathVertex
show all
- Includes:
- Contracts
- Defined in:
- middleman-core/lib/middleman-core/dependencies/vertices/data_collection_path_vertex.rb
Constant Summary
collapse
- TYPE_ID =
:data_path
- DATA_TYPE =
Or[Num, String, Symbol, Hash, Array]
Constants included
from Contracts
Contracts::PATH_MATCHER
Constants inherited
from Vertex
Vertex::SERIALIZED_VERTEX, Vertex::SERIALIZED_VERTEX_ATTRS, Vertex::VERTEX_ATTRS, Vertex::VERTEX_KEY
Instance Attribute Summary
Attributes inherited from Vertex
#attributes, #key
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Contracts
#Contract
Methods inherited from Vertex
#==, #matches_resource?, #merge!, #to_s, #type_id
Constructor Details
#initialize(key, attributes, controller = nil) ⇒ DataCollectionPathVertex
Returns a new instance of DataCollectionPathVertex.
28
29
30
31
32
|
# File 'middleman-core/lib/middleman-core/dependencies/vertices/data_collection_path_vertex.rb', line 28
def initialize(key, attributes, controller = nil)
super(key, attributes)
@controller = controller
end
|
Class Method Details
.deserialize(app, key, attributes) ⇒ Object
18
19
20
|
# File 'middleman-core/lib/middleman-core/dependencies/vertices/data_collection_path_vertex.rb', line 18
def self.deserialize(app, key, attributes)
DataCollectionPathVertex.new(key, attributes.symbolize_keys, app.data)
end
|
.from_data(app, path) ⇒ Object
23
24
25
|
# File 'middleman-core/lib/middleman-core/dependencies/vertices/data_collection_path_vertex.rb', line 23
def self.from_data(app, path)
DataCollectionPathVertex.new(path.map(&:to_s).join('.').to_sym, {}, app.data)
end
|
Instance Method Details
#serialize ⇒ Object
40
41
42
43
44
|
# File 'middleman-core/lib/middleman-core/dependencies/vertices/data_collection_path_vertex.rb', line 40
def serialize
super({
hash: current_hash || previous_hash
})
end
|
#valid? ⇒ Boolean
35
36
37
|
# File 'middleman-core/lib/middleman-core/dependencies/vertices/data_collection_path_vertex.rb', line 35
def valid?
current_hash == previous_hash
end
|