class Sphene::AttributeSet

Attributes

model[R]

Public Class Methods

from(model) click to toggle source
# File lib/sphene/attribute_set.rb, line 14
def self.from(model)
  new(model).tap do |data|
    model.class.attributes.each do |name, options|
      data[name] = Attribute.new(name, model, **options)
    end
  end
end
new(model) click to toggle source
Calls superclass method
# File lib/sphene/attribute_set.rb, line 9
def initialize(model)
  @model = model
  super({})
end

Public Instance Methods

to_hash() click to toggle source
# File lib/sphene/attribute_set.rb, line 22
def to_hash
  each.with_object({}) do |(name, attribute), data|
    data[name] = attribute.value
  end
end