class Qipowl::Yaml
Markup processor for Yaml
.
This class produces hash from YAML file.
Attributes
result[R]
Public Class Methods
new(file = nil)
click to toggle source
Calls superclass method
# File lib/qipowl/bowlers/yaml.rb, line 12 def initialize file = nil super merge_rules file if file end
parse(str)
click to toggle source
# File lib/qipowl/bowlers/yaml.rb, line 57 def self.parse str Yaml.new.parse_and_roll str end
Public Instance Methods
harvest(callee, str)
click to toggle source
# File lib/qipowl/bowlers/yaml.rb, line 41 def harvest callee, str if Hash === @partial if str == String::CARRIAGE_RETURN key = @partial.keys.last @partial.delete key @result[key] = @partial else @result.merge! @partial end else @result[str] = @partial unless str.vacant? end @partial = nil end
parse_and_roll(str)
click to toggle source
Calls superclass method
# File lib/qipowl/bowlers/yaml.rb, line 17 def parse_and_roll str @result = {} @partial = nil super str @result end
-(*args)
click to toggle source
Array
element handler
# File lib/qipowl/bowlers/yaml.rb, line 36 def - *args (@partial ||= []) << args.join(SEPARATOR).unuglify nil end
:(*args)
click to toggle source
Tupla handler
# File lib/qipowl/bowlers/yaml.rb, line 25 def : *args from, till, *rest = args.flatten if @partial.nil? or Hash === @partial (@partial ||= {})[from.unuglify] = till.unuglify rest else harvest ::, args.join(SEPARATOR).unbowl.unspacefy.uncarriage.strip end end