Sha256: 332402ad5afa53b146be785c633dc4e7b2f635a367a90b5a622c6037be3f1042
Contents?: true
Size: 669 Bytes
Versions: 3
Compression:
Stored size: 669 Bytes
Contents
require 'concern_builder' require 'darthjee/core_ext' class Danica::Common class VariablesBuilder < ::ConcernBuilder attr_reader :instance def init attr_names.each do |name| add_setter(name) add_reader(name) instance.send(:variables_names) << name end end private def add_setter(name) code = <<-CODE variables_hash[:#{name}] = wrap_value(value) @variables = variables_hash.values CODE add_method("#{name}=(value)", code) end def add_reader(name) code = <<-CODE variables_hash[:#{name}] CODE add_method("#{name}", code) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
danica-2.0.5 | lib/danica/common/variables_builder.rb |
danica-2.0.4 | lib/danica/common/variables_builder.rb |
danica-2.0.3 | lib/danica/common/variables_builder.rb |