Sha256: 7731ddd8a75f8cc3d51fbe76b841b8d1beeb436ead23a2fa91ed2e546e0f8905

Contents?: true

Size: 473 Bytes

Versions: 1

Compression:

Stored size: 473 Bytes

Contents

module Inspector
  class PropertyMetadata
    include Metadata

    attr_reader :property_name

    def initialize(type, property_name)
      @property_name = property_name
      super(type)
    end

    def property_value(object)
      object.__send__(:[], @property_name)
    rescue NoMethodError
      raise "metadata for #{@type.inspect} contains property metadata, however " +
            "#{object.inspect}[#{@property_name.inspect}] is not defined"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
object-inspector-0.1.0 lib/inspector/property_metadata.rb