Sha256: 5c16a31db8ed7de9246cb042c597a9b856cd96739313a69177979253775b1437

Contents?: true

Size: 654 Bytes

Versions: 5

Compression:

Stored size: 654 Bytes

Contents

module TelphinApi
  # A mixin for classes that will be resolved via `#method_missing`.
  module Resolvable
    attr_reader :name
    
    # Creates a resolvable object keeping it's name and the object that resolved it.
    # @param [String] name The name of this resolvable.
    # @option options [Hashie::Mash] :resolver A mash holding information about the previous resolver.
    def initialize(name, options = {})
      @name = name.to_s
      @previous_resolver = options.delete(:resolver)
    end
    
    # Returns the token from the previous resolver.
    # @return [String] A token.
    def token
      @previous_resolver.token
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
telphin_api-1.0.4 lib/telphin_api/resolvable.rb
telphin_api-1.0.3 lib/telphin_api/resolvable.rb
telphin_api-1.0.2 lib/telphin_api/resolvable.rb
telphin_api-1.0.1 lib/telphin_api/resolvable.rb
telphin_api-1.0.0 lib/telphin_api/resolvable.rb