Sha256: 75f92c662562aba66f213a329fb43e8be951287557f7c9ba81756508d7be3df3

Contents?: true

Size: 814 Bytes

Versions: 8

Compression:

Stored size: 814 Bytes

Contents

module Analyst

  module Entities

    module HasMethods

      def imethods
        @imethods ||= contents.select { |entity| entity.is_a? Analyst::Entities::InstanceMethod }
      end

      def cmethods
        some_methods = smethods.select { |method| method.target.type == :self }
        other_methods = singleton_class_blocks { |block| block.target.type == :self }.map(&:smethods).flatten
        some_methods + other_methods
      end

      def all_methods
        cmethods + imethods
      end

      def singleton_class_blocks
        contents.select { |entity| entity.is_a? Analyst::Entities::SingletonClass }
      end

      private

      def smethods
        @smethods ||= contents.select do |entity|
          entity.is_a? Analyst::Entities::SingletonMethod
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
analyst-1.2.4 lib/analyst/entities/mixins/has_methods.rb
analyst-1.2.3 lib/analyst/entities/mixins/has_methods.rb
analyst-1.2.2 lib/analyst/entities/mixins/has_methods.rb
analyst-1.2.1 lib/analyst/entities/mixins/has_methods.rb
analyst-1.2.0 lib/analyst/entities/mixins/has_methods.rb
analyst-1.0.1 lib/analyst/entities/mixins/has_methods.rb
analyst-1.0.0 lib/analyst/entities/mixins/has_methods.rb
analyst-0.16.1 lib/analyst/entities/mixins/has_methods.rb