Sha256: 6974ba3f6e62e750cf4d6c5aa8be44c65c1fc38d799d4611b859ccd42185f689

Contents?: true

Size: 439 Bytes

Versions: 3

Compression:

Stored size: 439 Bytes

Contents

require 'yaml'

module Kernel

  # The Kernel method #yaml is a shortcut to YAML::load.
  #
  #   data = yaml %{
  #     a: 1
  #     b: 2
  #   }  
  #   data #=> {"a"=>1, "b"=>2}
  #
  def yaml(*args,&blk)
    YAML.load(*args,&blk)
  end

  # As with #to_yaml but removes the header line (i.e. '---') to create
  # a "YAML fragment".
  #
  # @author Trans
  #
  def to_yamlfrag
    y = to_yaml
    y.sub!(/---\ */, '')
    y
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
facets-glimmer-3.2.0 lib/standard/facets/yaml/kernel.rb
facets-3.1.0 lib/standard/facets/yaml/kernel.rb
facets-3.0.0 lib/standard/facets/yaml/kernel.rb