Sha256: 86dc80079a555e40056c26b144ccb3547e5851caa5320776e556b8573097cf07

Contents?: true

Size: 717 Bytes

Versions: 3

Compression:

Stored size: 717 Bytes

Contents

module Analyst

  module Entities

    class Source < Entity

      handles_node :analyst_source

      def full_name
        ""
      end

      def file_path
        "$SOURCE$"
      end

      def location
        file_path
      end

      def origin_source
        parent.source_data_for(self)
      end

      def contents
        @contents ||= actual_contents.map do |child|
          # skip top-level CodeBlocks
          child.is_a?(Entities::CodeBlock) ? child.contents : child
        end.flatten
      end

      private

      def source_range
        0..-1
      end

      def actual_contents
        @actual_contents ||= ast.children.map { |child| process_node(child) }
      end

    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
analyst-1.0.1 lib/analyst/entities/source.rb
analyst-1.0.0 lib/analyst/entities/source.rb
analyst-0.16.1 lib/analyst/entities/source.rb