Sha256: ba98ad2069cf7c29e5a3548fbc7f517db7887abb0b661302dae29f589fd5adaa
Contents?: true
Size: 779 Bytes
Versions: 1
Compression:
Stored size: 779 Bytes
Contents
module Domain module Scalar def self.new(*component_names) ImplDomain.new [], instance_module(component_names) end def self.instance_module(component_names) Module.new{ define_method(:initialize) do |*args| component_names.zip(args).each do |n,arg| instance_variable_set(:"@#{n}", arg) end end component_names.each do |n| define_method(n) do instance_variable_get(:"@#{n}") end end define_method(:to_hash) do component_names.each_with_object({}) do |n,h| h[n] = instance_variable_get(:"@#{n}") end end include Equalizer.new(component_names) } end end # class Scalar end # module Domain
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
domain-1.0.0.rc1 | lib/domain/factory/scalar.rb |