class Inspector::AttributeMetadata

Attributes

attribute_name[R]

Public Class Methods

new(type, attribute_name) click to toggle source
Calls superclass method Inspector::Metadata::new
# File lib/inspector/attribute_metadata.rb, line 7
def initialize(type, attribute_name)
  @attribute_name = attribute_name.to_sym
  super(type)
end

Public Instance Methods

attribute_value(object) click to toggle source
# File lib/inspector/attribute_metadata.rb, line 12
def attribute_value(object)
  object.__send__(@attribute_name)
rescue NoMethodError
  raise "metadata for #{@type.inspect} contains attribute metadata, however " +
        "#{object.inspect}.#{@attribute_name.inspect} is not defined"
end