Sha256: 0c3b35a0ebe3847b8e566b5b59f744a3f9d50afc9d474ad7364bbb3a0bc87545
Contents?: true
Size: 1023 Bytes
Versions: 4
Compression:
Stored size: 1023 Bytes
Contents
module VkontakteApi # An API method namespace (such as `users` or `friends`). # # 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 `VkontakteApi::Method` using `VkontakteApi::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
4 entries across 4 versions & 1 rubygems