Sha256: 313145200f9bff18aa6c282a234355a9a2681fc1a516837cde3c18bf4500e001
Contents?: true
Size: 1 KB
Versions: 5
Compression:
Stored size: 1 KB
Contents
module TelphinApi # An API method namespace (such as `extensions` or `phone_calls`). # # It includes `Resolvable` and `Resolver` and calls API methods via `Resolver#call_method`. # It also holds the list of all known namespaces. class Namespace include Resolvable include Resolver # Creates and calls the `TelphinApi::Method` using `TelphinApi::Resolver#call_method`. def method_missing(*args, &block) call_method(args, &block) end class << self # An array of all method namespaces. # # Lazily loads the list from `namespaces.yml` and caches it. # @return [Array] An array of strings def names if @names.nil? filename = File.expand_path('../namespaces.yml', __FILE__) @names = YAML.load_file(filename) end @names end # Does a given namespace exist? # @param [String, Symbol] name def exists?(name) names.include?(name.to_s) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems