Class: DateTime

Inherits:
Object
  • Object
show all
Defined in:
lib/stone/core_ext/datetime.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.yaml_new(klass, tag, val) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/stone/core_ext/datetime.rb', line 6

def DateTime.yaml_new(klass, tag, val)
  if String === val
    self.parse(val)
  else
    raise YAML::TypeError, "Invalid DateTime: " + val.inspect
  end
end

Instance Method Details

#to_yaml(opts = {}) ⇒ Object



13
14
15
16
17
# File 'lib/stone/core_ext/datetime.rb', line 13

def to_yaml( opts = {} )
  YAML::quick_emit( object_id, opts ) do |out|
    out.scalar( taguri, self.to_s, :plain )
  end
end