Module: Syck
- Defined in:
- lib/yaml/syck.rb,
lib/rubysl/yaml/yaml.rb
Constant Summary collapse
Class Method Summary collapse
-
.merge_i(ary, hsh) ⇒ Object
– For Rubinius, replaces the rb_iterate call to syck_merge_i.
-
.mktime(str) ⇒ Object
– For Rubinius, replaces rb_syck_mktime.
-
.set_ivars(hsh, obj) ⇒ Object
– For Rubinius, replaces the rb_iterate call to syck_set_ivars.
Class Method Details
.merge_i(ary, hsh) ⇒ Object
– For Rubinius, replaces the rb_iterate call to syck_merge_i. ++
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/yaml/syck.rb', line 29 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 |
.mktime(str) ⇒ Object
– For Rubinius, replaces rb_syck_mktime. ++
45 46 47 48 49 50 51 52 |
# File 'lib/yaml/syck.rb', line 45 def self.mktime(str) require "date" begin DateTime.parse(str).to_time rescue ArgumentError # nothing end end |
.set_ivars(hsh, obj) ⇒ Object
– For Rubinius, replaces the rb_iterate call to syck_set_ivars. ++
20 21 22 23 24 |
# File 'lib/yaml/syck.rb', line 20 def self.set_ivars(hsh, obj) hsh.each do |key, value| obj.instance_variable_set :"@#{key}", value end end |