Sha256: 5f64f552d482c949c382b90c84907fae4c6e810248ba0348543a3dfb42cc3141

Contents?: true

Size: 855 Bytes

Versions: 37

Compression:

Stored size: 855 Bytes

Contents

class Module
  yaml_as "tag:ruby.yaml.org,2002:module"

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

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

  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
end

class Class
  yaml_as "tag:ruby.yaml.org,2002:class"
  remove_method :to_yaml if respond_to?(:to_yaml) && method(:to_yaml).owner == Class # use Module's to_yaml
end

class Struct
  def self.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
    "Struct::#{ name }"
  end
end

Version data entries

37 entries across 37 versions & 3 rubygems

Version Path
queue_dispatcher-2.5.3 lib/queue_dispatcher/syck_ext.rb
queue_dispatcher-2.3.0 lib/queue_dispatcher/syck_ext.rb
queue_dispatcher-2.1.0 lib/queue_dispatcher/syck_ext.rb
queue_dispatcher-1.5.1 lib/queue_dispatcher/syck_ext.rb
delayed_job-4.0.2 lib/delayed/syck_ext.rb
delayed_job-4.0.1 lib/delayed/syck_ext.rb
delayed_job-4.0.0 lib/delayed/syck_ext.rb
queue_dispatcher-1.3.1 lib/queue_dispatcher/syck_ext.rb
queue_dispatcher-1.3.0 lib/queue_dispatcher/syck_ext.rb
delayed_job-4.0.0.beta2 lib/delayed/syck_ext.rb
delayed_job-4.0.0.beta1 lib/delayed/syck_ext.rb
queue_dispatcher-1.2.0 lib/queue_dispatcher/syck_ext.rb
delayed_job-3.0.5 lib/delayed/syck_ext.rb
queue_dispatcher-1.1.19 lib/queue_dispatcher/syck_ext.rb
queue_dispatcher-1.1.18 lib/queue_dispatcher/syck_ext.rb
queue_dispatcher-1.1.17 lib/queue_dispatcher/syck_ext.rb
queue_dispatcher-1.1.16 lib/queue_dispatcher/syck_ext.rb
queue_dispatcher-1.1.15 lib/queue_dispatcher/syck_ext.rb
queue_dispatcher-1.1.14 lib/queue_dispatcher/syck_ext.rb
queue_dispatcher-1.1.12 lib/queue_dispatcher/syck_ext.rb