Class: Ryo::BasicObject

Inherits:
BasicObject
Defined in:
lib/ryo/basic_object.rb

Overview

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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

Returns an instance of Ryo::BasicObject

Parameters:

Returns:



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

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

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

Creates a Ryo object by recursively walking a Hash object

Parameters:

Returns:



26
27
28
# File 'lib/ryo/basic_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::BasicObject

Duplicates the internals of a Ryo object

Parameters:

Returns:



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

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