Class: JvYAML::Object

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cl, iv) ⇒ Object

Returns a new instance of Object.



83
84
85
# File 'lib/jvyaml.rb', line 83

def initialize(cl, iv)
  @class, @ivars = cl, iv
end

Instance Attribute Details

#classObject

Returns the value of attribute class.



82
83
84
# File 'lib/jvyaml.rb', line 82

def class
  @class
end

#ivarsObject

Returns the value of attribute ivars.



82
83
84
# File 'lib/jvyaml.rb', line 82

def ivars
  @ivars
end

Instance Method Details

#to_jvyaml(opts = {}) ⇒ Object



87
88
89
90
91
92
93
94
95
# File 'lib/jvyaml.rb', line 87

def to_jvyaml( opts = {} )
  JvYAML::quick_emit( object_id, opts ) do |out|
    out.map( "tag:ruby.yaml.org,2002:object:#{ @class }", to_jvyaml_style ) do |map|
      @ivars.each do |k,v|
        map.add( k, v )
      end
    end
  end
end