Sha256: c73b1e6da793abe08b09f6d7f7b60e95b71c483dbc3c6e67da4940a80d48cf36

Contents?: true

Size: 497 Bytes

Versions: 7

Compression:

Stored size: 497 Bytes

Contents

module Scrivito

class ObjDataFromHash < ObjData
  def initialize(attributes)
    @attributes = attributes.stringify_keys
  end

  def raw_value_and_type_of(attribute_name)
    if attribute_data = @attributes[attribute_name]
      if attribute_name.starts_with?('_')
        [attribute_data, nil]
      else
        attribute_data.reverse
      end
    else
      [nil, nil]
    end
  end

  def attribute_names_for_comparison
    @attributes.keys
  end

  def to_h
    @attributes
  end
end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
scrivito_sdk-0.65.1 lib/scrivito/obj_data_from_hash.rb
scrivito_sdk-0.65.0 lib/scrivito/obj_data_from_hash.rb
scrivito_sdk-0.65.0.rc2 lib/scrivito/obj_data_from_hash.rb
scrivito_sdk-0.65.0.rc1 lib/scrivito/obj_data_from_hash.rb
scrivito_sdk-0.60.0 lib/scrivito/obj_data_from_hash.rb
scrivito_sdk-0.60.0.rc2 lib/scrivito/obj_data_from_hash.rb
scrivito_sdk-0.60.0.rc1 lib/scrivito/obj_data_from_hash.rb