Class: ActiveBlocks::Decorator
- Inherits:
-
Object
- Object
- ActiveBlocks::Decorator
- Defined in:
- lib/active_blocks/decorator.rb,
lib/active_blocks/decorator/setup.rb,
lib/active_blocks/decorator/schema.rb,
lib/active_blocks/decorator/attributes/definition.rb,
lib/active_blocks/decorator/attributes/definitions_each.rb
Direct Known Subclasses
Defined Under Namespace
Modules: Attributes, Schema, Setup
Instance Attribute Summary
Attributes included from Setup
Class Method Summary collapse
Methods included from Schema
Methods included from Setup
#initialize, #setup_attribute, #setup_attributes
Class Method Details
.attribute(name, options = {}, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/active_blocks/decorator.rb', line 11 def attribute(name, ={}, &block) definitions[name.to_sym] = build_definition(name, ) mod = Module.new do define_method(name) { instance_variable_get("@#{name}") } define_method("#{name}=") { |value| instance_variable_set("@#{name}", value) } end include mod end |