Class: Alf::Renderer::YAML
- Inherits:
-
Alf::Renderer
- Object
- Alf::Renderer
- Alf::Renderer::YAML
- Defined in:
- lib/alf-io/alf/renderer/yaml.rb
Overview
Implements Alf::Renderer contract for outputing YAML files.
Constant Summary
Constants inherited from Alf::Renderer
Instance Attribute Summary
Attributes inherited from Alf::Renderer
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Alf::Renderer
by_mime_type, #execute, #initialize, register, renderer
Methods included from Support::Registry
#listen, #listeners, #register, #registered
Constructor Details
This class inherits a constructor from Alf::Renderer
Class Method Details
.mime_type ⇒ Object
8 9 10 |
# File 'lib/alf-io/alf/renderer/yaml.rb', line 8 def self.mime_type "text/x-yaml" end |
Instance Method Details
#each {|"---\n"| ... } ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/alf-io/alf/renderer/yaml.rb', line 12 def each return to_enum unless block_given? require "yaml" yield("---\n") input.each do |tuple| yield "-" << tuple.to_hash.to_yaml[4..-1].gsub(/^/, " ")[1..-1] end yield("\n") end |