Method: Sequence#prop
- Defined in:
- lib/sequence.rb
#prop(name = nil, *value) ⇒ Object
Get (if no value) and set properties. Normally, name should be a symbol. If name is nil, it wil get/set using a hash representing all of the properties.
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/sequence.rb', line 367 def prop(name=nil,*value) # :args: (name[,value]) if name.nil? if value.size.zero? defined?(@prop) &&@prop&&@prop.clone else if (value = value[0]).nil? defined?(@prop) &&@prop&&remove_instance_variable(:@prop) else (@prop||={}).replace(value) end end else if value.size.zero? defined?(@prop) &&@prop&&@prop[name] else (@prop||={})[name] = value[0] end end end |