class Ravanello::Yaml
Loads the router from yml file
Public Class Methods
new(yaml)
click to toggle source
# File lib/ravanello/yaml.rb, line 7 def initialize(yaml) @source = YAML.safe_load(yaml) end
Public Instance Methods
call()
click to toggle source
# File lib/ravanello/yaml.rb, line 11 def call router = Ravanello::Router.new process_group(router.root, @source['rules']) router end
Private Instance Methods
process_array_group(parent, yaml)
click to toggle source
# File lib/ravanello/yaml.rb, line 36 def process_array_group(parent, yaml) yaml.each { |name| parent.match(name).match('*') } end
process_group(parent, yaml)
click to toggle source
# File lib/ravanello/yaml.rb, line 19 def process_group(parent, yaml) case yaml when Hash process_hash_group(parent, yaml) when Array process_array_group(parent, yaml) end parent.match('*') end
process_hash_group(parent, yaml)
click to toggle source
# File lib/ravanello/yaml.rb, line 30 def process_hash_group(parent, yaml) yaml.each do |k, v| process_group(parent.match(k), v) end end