Sha256: 21aa915e01392df41b09f829ef3a0c8034051211a6df3bc864993426a6f6b6c8
Contents?: true
Size: 1.14 KB
Versions: 7
Compression:
Stored size: 1.14 KB
Contents
module Eco::Data::Locations module NodeBase require_relative 'node_base/tag_validations' include Eco::Data::Locations::NodeBase::TagValidations require_relative 'node_base/treeify' require_relative 'node_base/parsing' require_relative 'node_base/serial' require_relative 'node_base/csv_convert' require_relative 'node_base/builder' extend Eco::Data::Locations::NodeBase::Builder ALL_ATTRS = [] attr_accessor :tracked_level, :parent def copy self.class.new.set_attrs(**self.to_h) end def attr(sym) self.send(sym.to_sym) end def attr?(sym) !attr(sym).to_s.strip.empty? end def set_attrs(**kargs) kargs.each {|attr, value| set_attr(attr, value)} self end def set_attr(attr, value) self.send("#{attr}=", value) end def values_at(*attrs) attrs.map {|a| attr(a)} end def to_h(*attrs) attrs = self.class::ALL_ATTRS if attrs.empty? attrs.zip(values_at(*attrs)).to_h end def slice(*attrs) return {} if attrs.empty? to_h(*attrs) end end end
Version data entries
7 entries across 7 versions & 1 rubygems