class Yurl::API
Public Class Methods
add(aka, path)
click to toggle source
# File lib/yurl/api.rb, line 51 def self.add(aka, path) Yurl::AKA.add(Yurl::AKA_PATH, aka, path) end
dump(path, aka, pp, yaml)
click to toggle source
# File lib/yurl/api.rb, line 11 def self.dump(path, aka, pp, yaml) pp ||= false unless path.nil? yurl_object = Yurl::Engine.load_file(path) return yurl_object unless yurl_object.respond_to?(:has_key?) return Yurl::API.return_yurl(yurl_object, pp) end unless aka.nil? yurl_object = Yurl::Engine.load_file( Yurl::AKA.get_aka(Yurl::AKA_PATH, aka) ) return Yurl::API.return_yurl(yurl_object, pp) end return Yurl::API.return_yurl(yaml, pp) unless yaml.nil? 'No YAML found for yurl to process' end
get(path, aka, pp, yaml_url)
click to toggle source
# File lib/yurl/api.rb, line 28 def self.get(path, aka, pp, yaml_url) pp ||= false unless path.nil? haystack = Yurl::Engine.load_file(path) return haystack unless haystack.respond_to?(:has_key?) temp = Yurl::Engine.find(yaml_url, haystack) return Yurl::API.return_yurl(temp, pp) end unless aka.nil? haystack = Yurl::Engine.load_file( Yurl::AKA.get_aka(Yurl::AKA_PATH, aka) ) return haystack unless haystack.respond_to?(:has_key?) temp = Yurl::Engine.find(yaml_url, haystack) return Yurl::API.return_yurl(temp, pp) end "No Values found at specified location - #{yaml_url}" end
list()
click to toggle source
# File lib/yurl/api.rb, line 47 def self.list Yurl::AKA.print_list(Yurl::AKA_PATH) end
remove(aka)
click to toggle source
# File lib/yurl/api.rb, line 55 def self.remove(aka) Yurl::AKA.remove(Yurl::AKA_PATH, aka) end
return_yurl(yurl_object, pp)
click to toggle source
# File lib/yurl/api.rb, line 59 def self.return_yurl(yurl_object, pp) return Yurl::Engine.pretty_print_yaml(yurl_object) if pp == true Yurl::Engine.dump_yaml(yurl_object) end