Sha256: cc1d95dc89ebed299e2230a306628958cb99dc19e3bf7891091bf4bfa476b9fc
Contents?: true
Size: 928 Bytes
Versions: 2
Compression:
Stored size: 928 Bytes
Contents
require 'tap/tasks/stream' module Tap module Tasks class Stream # :startdoc::task streams data as YAML # # Stream loads data from the input IO as YAML. # # [example.yml] # --- # :sym # --- # - 1 # - 2 # - 3 # --- # key: value # # % tap stream/yaml --file example.yml -: inspect # :sym # [1, 2, 3] # {"key"=>"value"} # class Yaml < Stream # Streams data from io as YAML. def load(io) lines = [] while !io.eof? line = io.readline if line =~ /^---/ && !lines.empty? io.pos = io.pos - line.length break else lines << line end end YAML.load(lines.join) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tap-tasks-0.8.0 | lib/tap/tasks/stream/yaml.rb |
tap-tasks-0.7.0 | lib/tap/tasks/stream/yaml.rb |