Module: FinerStruct
- Defined in:
- lib/finer_struct/named.rb,
lib/finer_struct/mutable.rb,
lib/finer_struct/version.rb,
lib/finer_struct/immutable.rb
Defined Under Namespace
Modules: Named
Classes: Immutable, Mutable
Constant Summary
collapse
- VERSION =
"0.0.5"
Class Method Summary
collapse
Class Method Details
.Immutable(*attribute_names) ⇒ Object
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/finer_struct/immutable.rb', line 20
def self.Immutable(*attribute_names)
Named.build_class(attribute_names) do
attr_reader(*attribute_names)
def initialize(*)
super
freeze
end
end
end
|
.Mutable(*attribute_names) ⇒ Object
32
33
34
35
36
|
# File 'lib/finer_struct/mutable.rb', line 32
def self.Mutable(*attribute_names)
Named.build_class(attribute_names) do
attr_accessor(*attribute_names)
end
end
|