Class: Estructural
- Inherits:
-
Object
- Object
- Estructural
- Defined in:
- lib/estructural.rb
Constant Summary collapse
- VERSION =
'0.0.1'
Class Method Summary collapse
Class Method Details
.new(*attributes, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/estructural.rb', line 4 def self.new(*attributes, &block) Class.new do attributes.each do |attr| define_method(attr) { instance_variable_get("@#{attr}") } define_method("#{attr}=") {|value| instance_variable_set("@#{attr}", value) } end def initialize(args = {}) args.each { |attribute, value| send "#{attribute}=", value } end class_eval(&block) if block end end |