Class: Struct
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.new(*args) ⇒ Object
499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
# File 'lib/ron.rb', line 499 def new *args result=new__no_minus_op(*args) class<<result def -(*args) hash=args.first return super unless ::Hash===hash name.empty? and huh result=allocate hash.each{|(k,v)| result[k]=v } result end end result end |
.new__no_minus_op ⇒ Object
498 |
# File 'lib/ron.rb', line 498 alias new__no_minus_op new |
Instance Method Details
#to_ron_list(session) ⇒ Object
285 286 287 288 289 290 291 292 293 294 |
# File 'lib/ron.rb', line 285 def to_ron_list session self.class.name or raise NotSerializableError result=[self.class.name,"-{"]+ members.map{|memb| [memb.to_ron_list2(session) , "=>" , self[memb] , ', '] }.flatten<< "}" result=["(",result,")"].flatten unless instance_variables.empty? result end |