Sha256: 29aab44fa6fdb61cdb683a997b25502a44cc28ceb653a9a7aced2100d22663d4

Contents?: true

Size: 886 Bytes

Versions: 3

Compression:

Stored size: 886 Bytes

Contents

module DissociatedIntrospection
  class RubyClass
    class Def
      # @param [DissociatedIntrospection::RubyClass] ruby_code
      def initialize(ruby_code)
        @ruby_code = ruby_code
      end

      # @return [Symbol, NilClass]
      def name
        ruby_code.ast.children[0]
      end

      # @return [DissociatedIntrospection::RubyClass]
      def arguments
        RubyCode.build_from_ast(ruby_code.ast.children[1])
      end

      # @return [DissociatedIntrospection::RubyClass]
      def body
        RubyCode.build_from_ast(ruby_code.ast.children[2])
      end

      # @return [String]
      def source
        ruby_code.source
      end

      def to_s
        ruby_code.source
      end

      # @return [Parser::AST]
      def ast
        ruby_code.ast
      end

      # @return [DissociatedIntrospection::RubyClass]
      attr_reader :ruby_code
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dissociated_introspection-0.13.0 lib/dissociated_introspection/ruby_class/def.rb
dissociated_introspection-0.12.0 lib/dissociated_introspection/ruby_class/def.rb
dissociated_introspection-0.11.0 lib/dissociated_introspection/ruby_class/def.rb