Class: Module

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.yaml_new(klass, tag, val) ⇒ Object



9
10
11
# File 'lib/delayed/yaml_ext.rb', line 9

def self.yaml_new(klass, tag, val)
  val.constantize
end

Instance Method Details

#to_yaml(opts = {}) ⇒ Object



13
14
15
16
17
# File 'lib/delayed/yaml_ext.rb', line 13

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

#yaml_tag_read_class(name) ⇒ Object



19
20
21
22
23
24
# File 'lib/delayed/yaml_ext.rb', line 19

def yaml_tag_read_class(name)
  # Constantize the object so that ActiveSupport can attempt
  # its auto loading magic. Will raise LoadError if not successful.
  name.constantize
  name
end