Module: YAML::Syck

Defined in:
lib/yaml/syck.rb

Defined Under Namespace

Classes: Node

Class Method Summary collapse

Class Method Details

.merge_i(ary, hsh) ⇒ Object

– For Rubinius, replaces the rb_iterate call to syck_merge_i. ++



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/yaml/syck.rb', line 30

def self.merge_i(ary, hsh)
  ary.each do |entry|
    begin
      entry = Rubinius::Type.coerce_to entry, Hash, :to_hash
      hsh.update entry
    rescue
      # ignore coercion errors
    end
  end

  nil
end

.set_ivars(hsh, obj) ⇒ Object

– For Rubinius, replaces the rb_iterate call to syck_set_ivars. ++



21
22
23
24
25
# File 'lib/yaml/syck.rb', line 21

def self.set_ivars(hsh, obj)
  hsh.each do |key, value|
    obj.instance_variable_set :"@#{key}", value
  end
end