Module: FinerStruct

Defined in:
lib/finer_struct/named.rb,
lib/finer_struct/version.rb,
lib/finer_struct/named_mutable.rb,
lib/finer_struct/named_immutable.rb,
lib/finer_struct/anonymous_mutable.rb,
lib/finer_struct/anonymous_immutable.rb

Defined Under Namespace

Modules: Named Classes: Immutable, Mutable

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.Immutable(*attribute_names) ⇒ Object



5
6
7
# File 'lib/finer_struct/named_immutable.rb', line 5

def self.Immutable(*attribute_names)
  Named.build_class(Immutable, attribute_names)
end

.Mutable(*attribute_names) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/finer_struct/named_mutable.rb', line 5

def self.Mutable(*attribute_names)
  Named.build_class(Mutable, attribute_names) do
    attribute_names.each do |name|
      define_method(:"#{name}=") {|value| @attributes[name] = value }
    end
  end
end