Sha256: fe390e607e3c0717359b910f1548d2a53d732efa470b4f5dc737912b26dd39b4

Contents?: true

Size: 646 Bytes

Versions: 7

Compression:

Stored size: 646 Bytes

Contents

module Simplabs

  module Excellent

    module Parsing

      class CallContext < SexpContext #:nodoc:

        include Comparable

        attr_reader :receiver
        attr_reader :method

        def initialize(exp, parent)
          super
          @receiver  = exp[1].is_a?(Sexp) ? (exp[1][1].nil? ? exp[1][2].to_s : exp[1][1].to_s) : nil
          @method    = exp[2].to_s
          @full_name = [@receiver, @method].compact.join('.')
        end

        def <=>(other)
          @full_name <=> other.full_name
        end
        alias :eql? :'<=>'

        def hash
          @full_name.hash
        end

      end

    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
simplabs-excellent-1.2.1 lib/simplabs/excellent/parsing/call_context.rb
simplabs-excellent-1.2.2 lib/simplabs/excellent/parsing/call_context.rb
simplabs-excellent-1.3.0 lib/simplabs/excellent/parsing/call_context.rb
simplabs-excellent-1.3.1 lib/simplabs/excellent/parsing/call_context.rb
simplabs-excellent-1.4.0 lib/simplabs/excellent/parsing/call_context.rb
simplabs-excellent-1.4.1 lib/simplabs/excellent/parsing/call_context.rb
simplabs-excellent-1.4.2 lib/simplabs/excellent/parsing/call_context.rb