Module: DbAgile::IO::YAML

Extended by:
TypeSafe
Defined in:
lib/dbagile/io/yaml.rb

Class Method Summary collapse

Methods included from TypeSafe

from_typesafe_relation, from_typesafe_tuple, from_typesafe_xxx, to_typesafe_relation, to_typesafe_tuple, with_type_safe_relation

Class Method Details

.from_yaml(input, options = {}, &block) ⇒ Object

Loads some data from a yaml input. If a block is given, yields it with each tuple in turn and returns nil. Otherwise returns an array of tuples.



22
23
24
25
# File 'lib/dbagile/io/yaml.rb', line 22

def from_yaml(input, options = {}, &block)
  require 'yaml'
  from_typesafe_xxx(::YAML::load(input), options, &block)
end

.to_yaml(data, columns = nil, buffer = "", options = {}) ⇒ ...

Outputs some data as a YAML string

Returns:

  • (...)

    the buffer itself



11
12
13
14
15
# File 'lib/dbagile/io/yaml.rb', line 11

def to_yaml(data, columns = nil, buffer = "", options = {})
  require 'yaml'
  ::YAML::dump(to_typesafe_relation(options[:type_system], data), buffer)
  buffer
end