class SetAttributes::DataSource::Object

Constants

Error

Public Class Methods

verify_mapping(source, include) click to toggle source
# File lib/set_attributes/data_source/object.rb, line 8
  def self.verify_mapping(source, include)
    if include.nil?
      raise Error, "Object source is missing the include mapping"
    end

    return include
  end

  def get_value(attribute)
    return nil unless attribute?(attribute)
    source.send(attribute)
  end
  alias :[] :get_value

  def attribute?(attribute)
    source.respond_to?(attribute)
  end
end

Public Instance Methods

attribute?(attribute) click to toggle source
# File lib/set_attributes/data_source/object.rb, line 22
def attribute?(attribute)
  source.respond_to?(attribute)
end
get_value(attribute) click to toggle source
# File lib/set_attributes/data_source/object.rb, line 16
def get_value(attribute)
  return nil unless attribute?(attribute)
  source.send(attribute)
end