Module: Sycl

Defined in:
lib/sycl.rb

Defined Under Namespace

Classes: Array, Hash

Class Method Summary collapse

Class Method Details

.dump(object) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/sycl.rb', line 50

def self.dump(object)
  if (object.is_a?(::Hash)  && !object.is_a?(Sycl::Hash)) ||
     (object.is_a?(::Array) && !object.is_a?(Sycl::Array))
    sycl_version = from_object object
    sycl_version.to_yaml
  else
    object.to_yaml
  end
end

.load(yaml) ⇒ Object

Sycl::load(yaml), Sycl::load_file(filename), and Sycl::dump(object) function just like their YAML counterparts, but return and act on Sycl-blessed variants of Hashes and Arrays.



42
43
44
# File 'lib/sycl.rb', line 42

def self.load(yaml)
  from_object YAML::load(yaml)
end

.load_file(filename) ⇒ Object



46
47
48
# File 'lib/sycl.rb', line 46

def self.load_file(filename)
  from_object YAML::load_file(filename)
end