Module: Rupture::Meta
- Defined in:
- lib/rupture/meta.rb
Instance Method Summary collapse
- #clone(meta = nil) ⇒ Object
- #meta ⇒ Object
- #vary_meta(*args, &fn) ⇒ Object
- #with_meta(meta) ⇒ Object
Instance Method Details
#clone(meta = nil) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/rupture/meta.rb', line 6 def clone( = nil) ||= @_meta.clone if @_meta raise "meta must be of type Hash, it is #{.class}" unless .nil? or .kind_of?(Hash) or .kind_of?(Rupture::HashMap) copy = super() copy.instance_variable_set(:@_meta, ) copy end |
#meta ⇒ Object
2 3 4 |
# File 'lib/rupture/meta.rb', line 2 def @_meta ||= {} end |
#vary_meta(*args, &fn) ⇒ Object
18 19 20 21 |
# File 'lib/rupture/meta.rb', line 18 def (*args, &fn) fn ||= args.shift (fn[, *args]) end |
#with_meta(meta) ⇒ Object
14 15 16 |
# File 'lib/rupture/meta.rb', line 14 def () clone() end |