Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Support multiple parser paths #44

Merged
merged 1 commit into from

3 participants

@josh

No description provided.

@josh josh commented on the diff
lib/kss/parser.rb
@@ -10,14 +10,16 @@ class Parser
# within the directory recursively for any comment blocks that look like
# KSS.
#
- # base_path - The path String where style files are located.
- def initialize(base_path)
+ # paths - Each path String where style files are located.
+ def initialize(*paths)
@josh
josh added a note

Not sure how multiple args are even supposed to be doc'd in TomDoc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@jonrohan

Soy un perdedor :metal:

@kneath kneath merged commit 86d7e30 into kneath:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 13, 2012
  1. @josh

    Support multiple parser paths

    josh authored
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 6 deletions.
  1. +8 −6 lib/kss/parser.rb
  2. +5 −0 test/parser_test.rb
View
14 lib/kss/parser.rb
@@ -10,14 +10,16 @@ class Parser
# within the directory recursively for any comment blocks that look like
# KSS.
#
- # base_path - The path String where style files are located.
- def initialize(base_path)
+ # paths - Each path String where style files are located.
+ def initialize(*paths)
@josh
josh added a note

Not sure how multiple args are even supposed to be doc'd in TomDoc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@sections = {}
- Dir["#{base_path}/**/*.*"].each do |filename|
- parser = CommentParser.new(filename)
- parser.blocks.each do |comment_block|
- add_section comment_block, filename if self.class.kss_block?(comment_block)
+ paths.each do |path|
+ Dir["#{path}/**/*.*"].each do |filename|
+ parser = CommentParser.new(filename)
+ parser.blocks.each do |comment_block|
+ add_section comment_block, filename if self.class.kss_block?(comment_block)
+ end
end
end
end
View
5 test/parser_test.rb
@@ -7,6 +7,7 @@ def setup
@sass_parsed = Kss::Parser.new('test/fixtures/sass')
@css_parsed = Kss::Parser.new('test/fixtures/css')
@less_parsed = Kss::Parser.new('test/fixtures/less')
+ @multiple_parsed = Kss::Parser.new('test/fixtures/scss', 'test/fixtures/less')
@css_comment = <<comment
/*
@@ -104,4 +105,8 @@ def setup
assert_equal 2, @css_parsed.sections.count
end
+ test "parse multiple paths" do
+ assert_equal 6, @multiple_parsed.sections.count
+ end
+
end
Something went wrong with that request. Please try again.