Sha256: bc29fcf22b898f32b82b6477fa2fa01daafa5033732fef913e6cfb560877643d

Contents?: true

Size: 845 Bytes

Versions: 9

Compression:

Stored size: 845 Bytes

Contents

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

  def self.yaml_new(klass, tag, val)
    klass
  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

9 entries across 9 versions & 2 rubygems

Version Path
delayed_job_unique_key-0.0.4 lib/delayed/syck_ext.rb
delayed_job-3.0.0 lib/delayed/syck_ext.rb
delayed_job_unique_key-0.0.3 lib/delayed/syck_ext.rb
delayed_job_unique_key-0.0.2 lib/delayed/syck_ext.rb
delayed_job_unique_key-0.0.1 lib/delayed/syck_ext.rb
delayed_job-3.0.0.pre4 lib/delayed/syck_ext.rb
delayed_job-3.0.0.pre3 lib/delayed/syck_ext.rb
delayed_job-3.0.0.pre2 lib/delayed/syck_ext.rb
delayed_job-3.0.0.pre lib/delayed/syck_ext.rb