Sha256: eb28c5b9357062f468c270ccb4df34e87d3eac49e7c6fc58f37fda07506e5c83
Contents?: true
Size: 1.14 KB
Versions: 7
Compression:
Stored size: 1.14 KB
Contents
module Scrivito class ObjData def value_of(attribute_name) value_and_type_of(attribute_name).first end def type_of(attribute_name) value_and_type_of(attribute_name).second end def value_and_type_of(attribute_name) if attribute_name.starts_with?('_') [raw_value_and_type_of(attribute_name).first, nil] else raw_value_and_type_of(attribute_name) end end def to_h raise NotImplementedError, 'implement in subclass' end def raw_value_and_type_of(attribute_name) raise NotImplementedError, "implement in subclass" end def attribute_names_for_comparison raise NotImplementedError, "implement in subclass" end def ==(other) return false unless other.is_a?(ObjData) attribute_names = attribute_names_for_comparison | other.attribute_names_for_comparison attribute_names.reject! { |attribute_name| attribute_name.starts_with?('_') } attribute_names += %w[_path _permalink _widget_pool] attribute_names.all? do |attribute_name| value_of(attribute_name) == other.value_of(attribute_name) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems