Sha256: 7cd445a77ebc45f8fb32908236ff0f0c8f398c07bd4f9abe502ae5b4cf58c408

Contents?: true

Size: 609 Bytes

Versions: 2

Compression:

Stored size: 609 Bytes

Contents

require 'core_ext/hash/keys'
require 'core_ext/string/underscore'

module CMIS
  class PropertyDefinition
    def initialize(hash = {})
      @hash = hash.stringify_keys
      @hash.each_key do |key|
        self.class.class_eval "def #{key.underscore};@hash['#{key}'];end"
        self.class.class_eval "def #{key.underscore}=(value);@hash['#{key}']=value;end"
      end
    end

    def readonly?
      updatability == 'readonly'
    end

    def oncreate?
      updatability == 'oncreate'
    end

    def readwrite?
      updatability == 'readwrite'
    end

    def to_hash
      @hash
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cmis-ruby-0.4.4 lib/cmis/property_definition.rb
cmis-ruby-0.4.3 lib/cmis/property_definition.rb