Sha256: 12e27c9c08ada694d2153c14ea72b3a9d0bdc38eedfe53dd5adcf0e53989681a

Contents?: true

Size: 1006 Bytes

Versions: 15

Compression:

Stored size: 1006 Bytes

Contents

require 'reek/source/source_code'

#
# Extensions to +File+ needed by Reek.
#
class File
  #
  # Creates a new +Source+ that assumes this File contains Ruby source
  # code and prepares it to be examined for code smells.
  #
  # @return [Reek::Source::SourceFile]
  #
  def to_reek_source
    Reek::Source::SourceFile.new(path)
  end
end

#
# Extensions to +IO+ needed by Reek.
#
class IO
  #
  # Creates a new +Source+ that assumes this IO stream contains Ruby source
  # code and prepares it to be examined for code smells.
  #
  # @return [Reek::Source::SourceCode]
  #
  def to_reek_source(description = 'io')
    Reek::Source::SourceCode.new(readlines.join, description)
  end
end

#
# Extensions to +String+ needed by Reek.
#
class String
  #
  # Creates a new +Source+ that assumes this string contains Ruby source
  # code and prepares it to be examined for code smells.
  #
  # @return [Reek::Source::SourceCode]
  #
  def to_reek_source
    Reek::Source::SourceCode.new(self, 'string')
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
reek-2.0.4 lib/reek/source/core_extras.rb
reek-2.0.3 lib/reek/source/core_extras.rb
reek-2.0.2 lib/reek/source/core_extras.rb
reek-2.0.1 lib/reek/source/core_extras.rb
reek-2.0.0 lib/reek/source/core_extras.rb
reek-1.6.6 lib/reek/source/core_extras.rb
reek-1.6.5 lib/reek/source/core_extras.rb
reek-1.6.4 lib/reek/source/core_extras.rb
reek-1.6.3 lib/reek/source/core_extras.rb
reek-1.6.2 lib/reek/source/core_extras.rb
reek-1.6.1 lib/reek/source/core_extras.rb
reek-1.6.0 lib/reek/source/core_extras.rb
reek-1.5.1 lib/reek/source/core_extras.rb
reek-1.5.0 lib/reek/source/core_extras.rb
reek-1.4.0 lib/reek/source/core_extras.rb