Module: L43::OpenObject
- Defined in:
- lib/l43/open_object.rb,
lib/l43/open_object/version.rb,
lib/l43/open_object/behavior.rb,
lib/l43/open_object/initializer.rb
Defined Under Namespace
Modules: Behavior, Initializer
Constant Summary
collapse
- VERSION =
"0.3.0"
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.def_class(*a, **k, &b) ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/l43/open_object.rb', line 41
def self.def_class(*a, **k, &b)
oo = self
Class.new do
extend oo
attributes(*a, **k, &b)
end
end
|
Instance Method Details
#attributes(*atts, **defaults, &blk) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/l43/open_object.rb', line 8
def attributes(*atts, **defaults, &blk)
attr_reader(*atts)
attr_reader(*defaults.keys)
Initializer.define_initialize(self, atts, defaults, blk)
include Behavior
end
|
#mutable? ⇒ Boolean
37
38
39
|
# File 'lib/l43/open_object.rb', line 37
def mutable?
instance_variable_get("@__mutable__") || false
end
|
#mutable_object! ⇒ Object
33
34
35
|
# File 'lib/l43/open_object.rb', line 33
def mutable_object!
instance_variable_set("@__mutable__", true)
end
|