Class: Class

Inherits:
Object show all
Defined in:
lib/ron.rb,
lib/ron.rb

Overview

Class#-

Instance Method Summary collapse

Instance Method Details

#-(*args) ⇒ Object

construct an instance of a class from the data in hash



478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# File 'lib/ron.rb', line 478

def -(*args)
  hash=args.first
  #name.empty? and huh
  Array===hash and return make( *hash )
  return super unless ::Hash===hash
  allocate.instance_eval{
    hash.each{|(k,v)| 
      if ?@==k.to_s[0] 
        instance_variable_set(k,v) 
      else
        send(k+"=",v)
      end
    }
    return self
  }
end

#to_ronObject



332
333
334
335
# File 'lib/ron.rb', line 332

def to_ron
  name.empty? and raise ::Ron::NotSerializeableError
  name
end