Sha256: a44c802b5e5eabb0f2c3e0b29d391ea874cf811084540417a49c259413f5e59f

Contents?: true

Size: 1.45 KB

Versions: 6

Compression:

Stored size: 1.45 KB

Contents

require 'boson/comment_inspector'
require 'boson/more_method_inspector'

module Boson
  # When deciding whether to use commented or normal Module methods, remember that commented Module methods allow
  # independence from Boson (useful for testing).
  # See CommentInspector for more about commented method attributes.
  class Inspector
    module MoreInspector
      def add_data
        super
        add_comment_scraped_data
      end

      def add_comment_scraped_data
        (@store[:method_locations] || []).select {|k,(f,l)| f == @library_file }.each do |cmd, (file, lineno)|
          scraped = CommentInspector.scrape(FileLibrary.read_library_file(file), lineno, MethodInspector.instance.current_module)
          @commands_hash[cmd] ||= {}
          MethodInspector::METHODS.each do |e|
            add_valid_data_to_config(e, scraped[e], cmd)
          end
        end
      end
    end
    include MoreInspector
  end

  # This module also saves method locations so CommentInspector
  # can scrape their commented method attributes.
  class MethodInspector
    module MoreInspector
      def inspector_in_file?(meth, inspector_method)
        return false if !super
        if File.exists?(file_line[0]) && (options = CommentInspector.scrape(
          FileLibrary.read_library_file(file_line[0]), file_line[1], @current_module, inspector_method) )
          (store[inspector_method] ||= {})[meth] = options
        end
      end
    end
    include MoreInspector
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
boson-more-0.3.1 lib/boson/more_inspector.rb
boson-more-0.3.0 lib/boson/more_inspector.rb
boson-more-0.2.2 lib/boson/more_inspector.rb
boson-more-0.2.1 lib/boson/more_inspector.rb
boson-more-0.2.0 lib/boson/more_inspector.rb
boson-more-0.1.0 lib/boson/more_inspector.rb