Sha256: b1e7252a61075bffe056d89c8cac8592f10869bfc58f76cc261528a42b081bc3

Contents?: true

Size: 453 Bytes

Versions: 1

Compression:

Stored size: 453 Bytes

Contents

module Linodians
  ##
  # Employee object
  class Employee
    def initialize(params = {})
      @raw = params
    end

    def [](value)
      @raw[value.to_sym] || @raw[value.to_s]
    end

    def respond_to?(method, _)
      @raw.key?(method) || super
    end

    def method_missing(method, *args, &block)
      return super unless @raw.key?(method)
      instance_eval "def #{method}() @raw[:'#{method}'] end"
      send(method)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
linodians-0.0.1 lib/linodians/employee.rb