Sha256: 3f073bfd68bffd430779bed8008ee976017fd4a8f69d2c9aebb8b53ec439cb53

Contents?: true

Size: 946 Bytes

Versions: 1

Compression:

Stored size: 946 Bytes

Contents

module RailsConnector

  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)
      raise "implement in subclass"
    end

    def has_custom_attribute?(name)
      raise "implement in subclass"
    end

    def all_custom_attributes
      raise "implement in subclass"
    end

    private

    def type_of_internal(key)
      case key
      when "_text_links"
        "linklist"
      when "_valid_from", "_valid_until", "_last_changed"
        "date"
      when "title", "body"
        "html"
      when "blob"
        "binary"
      else
        nil
      end
    end

    def default_attribute_value(attribute_type)
      case attribute_type
      when "linklist"
        []
      when "multienum"
        []
      else
        nil
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
infopark_cloud_connector-7.1.0 lib/rails_connector/obj_data.rb