Sha256: 4bb9aeeaadf7f2179c54ab774e22f9966355e4094826aa7a78c980a825843501

Contents?: true

Size: 648 Bytes

Versions: 10

Compression:

Stored size: 648 Bytes

Contents

module Zapata
  module Primitive
    class Def < Base
      attr_accessor :klass

      def initialize(code)
        @code = code
        @klass = Diver.current_klass
        @self = Diver.current_sklass
        @access_level = Diver.access_level
        dive_deeper
      end

      def self?
        !!@self
      end

      def public?
        @access_level == :public
      end

      def node
        name, args, body = @code.to_a
        type = @code.type
        OpenStruct.new(type: type, name: name, args: args, body: body)
      end

      def literal_predicted_args
        Predictor::Args.literal(node.args)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
zapata-0.1.6 lib/zapata/primitive/def.rb
zapata-0.1.5 lib/zapata/primitive/def.rb
zapata-0.1.4 lib/zapata/primitive/def.rb
zapata-0.1.3 lib/zapata/primitive/def.rb
zapata-0.1.2 lib/zapata/primitive/def.rb
zapata-0.1.1 lib/zapata/primitive/def.rb
zapata-0.1.0 lib/zapata/primitive/def.rb
zapata-0.0.3 lib/zapata/primitive/def.rb
zapata-0.0.2 lib/zapata/primitive/def.rb
zapata-0.0.1 lib/zapata/primitive/def.rb