Sha256: e25a56cd0d60d5686bee617b68ae28ac4a4652f9462cfe39f4fa83e3e1579910

Contents?: true

Size: 374 Bytes

Versions: 2

Compression:

Stored size: 374 Bytes

Contents

require "config_mapper/mapper"

module ConfigMapper

  # Configuration proxy for an Object.
  #
  class ObjectMapper < Mapper

    def initialize(object)
      @object = object
    end

    def path(key)
      ".#{key}"
    end

    def get(key)
      @object.public_send(key)
    end

    def set(key, value)
      @object.public_send("#{key}=", value)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
config_mapper-1.2.0 lib/config_mapper/object_mapper.rb
config_mapper-1.1.1 lib/config_mapper/object_mapper.rb