Class: Ryo::Object

Inherits:
Object
  • Object
show all
Defined in:
lib/ryo/object.rb

Overview

Ryo::Object is a Ryo object and subclass of Ruby's Object class that can be created by using Ryo(), Ryo.Object(), Ryo::Object.from, or Ryo::Object.create.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create(props, prototype = nil) ⇒ Ryo::Object

Returns an instance of Ryo::Object

Parameters:

Returns:



15
16
17
# File 'lib/ryo/object.rb', line 15

def self.create(props, prototype = nil)
  Ryo::Builder.build(self, props, prototype)
end

.from(props, prototype = nil) ⇒ Ryo::Object

Creates a Ryo object by recursively walking a Hash object

Parameters:

Returns:



26
27
28
# File 'lib/ryo/object.rb', line 26

def self.from(props, prototype = nil)
  Ryo::Builder.recursive_build(self, props, prototype)
end

Instance Method Details

#initialize_dup(ryo) ⇒ Ryo::Object

Duplicates the internals of a Ryo object

Parameters:

Returns:



37
38
39
40
# File 'lib/ryo/object.rb', line 37

def initialize_dup(ryo)
  Ryo.set_table_of(self, Ryo.table_of(ryo).dup)
  Ryo.extend!(self, Ryo)
end