Sha256: 743893f777003ebabd9a151202ec4b291a0ab4316ad506a85aa01509a6fc420b

Contents?: true

Size: 455 Bytes

Versions: 2

Compression:

Stored size: 455 Bytes

Contents

module Restfulie
  
  module Client
  
    # adds respond_to and has_state methods to resources
    module State
    
      # overrides the respond_to? method to check if this method is contained or was defined by a state
      def respond_to?(sym)
        has_state(sym.to_s) || super(sym)
      end

      # returns true if this resource has a state named name
      def has_state(name)
        !@_possible_states[name].nil?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
restfulie-0.5.0 lib/restfulie/client/state.rb
restfulie-0.4.0 lib/restfulie/client/state.rb