class Coypond::CoypondRunner

Public Class Methods

new(files) click to toggle source
# File lib/coypond.rb, line 7
def initialize(files)
  @files = files
end

Public Instance Methods

Private Instance Methods

each_file() { |file, source, parser| ... } click to toggle source
# File lib/coypond.rb, line 45
def each_file
  @files.each do |file|
    source = File.read(file)
    parse_tree = Ripper::SexpBuilder.new(source).parse
    parser = Coypond::Parser.new.parse(parse_tree)
    yield(file, source, parser)
  end
end
search_in_collection(collection, options) click to toggle source
# File lib/coypond.rb, line 32
def search_in_collection(collection, options)
  search_term = options[:search_term]
  search_term = search_term.downcase if options[:ignore_case]
  collection.select do |k,v|
    k = k.downcase if options[:ignore_case]
    if options[:regexp]
      Regexp.new("(#{search_term})$").match(k)
    else
      k.end_with?(search_term)
    end
  end
end