Class: Blaml::MetaArray
Overview
Wraps Array instances with metadata.
Instance Attribute Summary
Attributes inherited from MetaNode
Instance Method Summary collapse
-
#meta ⇒ Object
Returns the child metadata with the most recent change.
-
#to_value ⇒ Object
Strips MetaNode wrapper from the value and calls to_value on all array elements.
Methods inherited from MetaNode
#==, #initialize, #method_missing, #to_yaml
Constructor Details
This class inherits a constructor from Blaml::MetaNode
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Blaml::MetaNode
Instance Method Details
#meta ⇒ Object
Returns the child metadata with the most recent change.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/blaml/meta.rb', line 85 def = nil path_key = nil @value.each_with_index do |val, i| next unless val.respond_to? :meta = val..dup and path_key = i if ! || && val. && val.[:updated_at] > [:updated_at] end ([:path] ||= []).unshift path_key if && path_key end |
#to_value ⇒ Object
Strips MetaNode wrapper from the value and calls to_value on all array elements.
106 107 108 |
# File 'lib/blaml/meta.rb', line 106 def to_value @value.map{|v| v.respond_to?(:to_value) ? v.to_value : v } end |