module ActiveBlocks::Decorator::Setup

Attributes

attributes[R]
model[R]

Public Class Methods

new(model, attributes={}) click to toggle source
# File lib/active_blocks/decorator/setup.rb, line 7
def initialize(model, attributes={})
  @attributes = {}
  @model      = model

  setup_attributes(attributes)
end

Public Instance Methods

setup_attribute(name, value) click to toggle source
# File lib/active_blocks/decorator/setup.rb, line 20
def setup_attribute(name, value)
  return false unless respond_to?("#{name}=")

  send("#{name}=", value)
end
setup_attributes(attributes) click to toggle source
# File lib/active_blocks/decorator/setup.rb, line 14
def setup_attributes(attributes)
  attributes.each do |k, v|
    setup_attribute(k, v)
  end
end