class SBF::Client::NotImplementedObject

Attributes

props[RW]

Public Class Methods

new(attributes = {}) click to toggle source
Calls superclass method SBF::Client::BaseEntity::new
# File lib/stbaldricks/entities/lib/not_implemented_object.rb, line 9
def initialize(attributes = {})
  @props = {}.tap do |hsh|
    attributes.each do |k, v|
      hsh[k.to_sym] = v
    end
  end

  super
end

Public Instance Methods

method_missing(name) click to toggle source

rubocop:disable Style/MissingRespondToMissing

Calls superclass method
# File lib/stbaldricks/entities/lib/not_implemented_object.rb, line 20
def method_missing(name)
  return @props[name.to_sym] if @props.key?(name.to_sym)

  super.method_missing(name)
end
to_hash() click to toggle source

rubocop:enable Style/MissingRespondToMissing

# File lib/stbaldricks/entities/lib/not_implemented_object.rb, line 27
def to_hash
  {}.tap do |hsh|
    props.each { |k, v| hsh[k] = v }
    self.class.defined_attributes.each { |name| hsh[name] = send(name.to_sym) unless hsh.key?(name.to_sym) || name.to_sym == :props }
  end
end