Class: Kumogata2::Plugin::YAML
- Inherits:
-
Object
- Object
- Kumogata2::Plugin::YAML
- Defined in:
- lib/kumogata2/plugin/yaml.rb
Instance Method Summary collapse
- #dump(hash, color = true) ⇒ Object
-
#initialize(options) ⇒ YAML
constructor
A new instance of YAML.
- #parse(str) ⇒ Object
Constructor Details
#initialize(options) ⇒ YAML
Returns a new instance of YAML.
6 7 8 |
# File 'lib/kumogata2/plugin/yaml.rb', line 6 def initialize() @options = end |
Instance Method Details
#dump(hash, color = true) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/kumogata2/plugin/yaml.rb', line 14 def dump(hash, color = true) Hashie.stringify_keys!(hash) if color YAML.dump(hash).colorize_as(:yaml) else YAML.dump(hash) end end |
#parse(str) ⇒ Object
10 11 12 |
# File 'lib/kumogata2/plugin/yaml.rb', line 10 def parse(str) YAML.load(str) end |