class ValueStruct
Constants
- VERSION
Public Class Methods
new(*args, &block)
click to toggle source
# File lib/value_struct.rb, line 29 def new(*args, &block) mixins = [ValueStruct::DupWithChanges] new_with_mixins(*args, mixins, &block) end
Also aliased as: build
new_with_mixins(*args, mixins, &block)
click to toggle source
# File lib/value_struct.rb, line 13 def new_with_mixins(*args, mixins, &block) raise ArgumentError, 'mixin list (last paramater) must be an array' unless mixins.is_a? Array struct_class = build(*args, &block) struct_class.send(:include, ValueStruct::Immutable) mixins.each{ |mixin| if mixin.is_a?(Symbol) # convenient including bundled mixins ala :dup_with_changes mixin = ValueStruct.const_get(mixin.to_s.gsub(/(?:^|_)([a-z])/){ $1.upcase }) end struct_class.send(:include, mixin) } struct_class end
Public Instance Methods
inspect()
click to toggle source
Calls superclass method
# File lib/value_struct.rb, line 35 def inspect super.to_s.sub('struct', 'ValueStruct') end