Sha256: 33cde39cbbe07cb0b7d30f81e3ac4610ab8558b18f70fed89f66ac571f1a6853

Contents?: true

Size: 679 Bytes

Versions: 1

Compression:

Stored size: 679 Bytes

Contents

# frozen_string_literal: true

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

1 entries across 1 versions & 1 rubygems

Version Path
zapata-1.0.0 lib/zapata/primitive/def.rb