Sha256: 100afab40013baac3a18424e50c49c6cd97d2c77799b0f2a745030573c898e0c
Contents?: true
Size: 809 Bytes
Versions: 1
Compression:
Stored size: 809 Bytes
Contents
require File.dirname(__FILE__) + '/tree' require File.dirname(__FILE__) + '/line' require File.dirname(__FILE__) + '/cli' module TodoNext class Parser def self.parse(text, prune_example_nodes=true) lines = extract_meaningful_lines(text) tree = Tree::Factory.build(lines) if prune_example_nodes tree.visit(TodoNext::Tree::Visitor::ExampleNodesRemover.new) tree.visit(TodoNext::Tree::Visitor::LeafMaker .new) end tree end def self.extract_meaningful_lines(text) text. split("\n"). collect do |text| col_offset = text =~ /\S/ Line.new(text.strip, col_offset) end. reject{|l| l.blank? }. reject{|l| l.comment?}. reject{|l| l.passed?} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
todo_next-0.0.2 | lib/todo_next/parser.rb |