Sha256: 600b32bf87c0e1033bdcd7c57313b64a4aba4d7c240ae2563529c8ae494692ac

Contents?: true

Size: 888 Bytes

Versions: 2

Compression:

Stored size: 888 Bytes

Contents

#:enddoc:
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

    private

    def type_of_internal(key)
      case key
      when "_text_links"
        "linklist"
      when "_valid_from"
        "date"
      when "_valid_until"
        "date"
      when "_last_changed"
        "date"
      when "title"
        "html"
      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

2 entries across 2 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.8.0.210.ed204b0 lib/rails_connector/obj_data.rb
infopark_cloud_connector-6.8.0.110.6570b45 lib/rails_connector/obj_data.rb