scrub 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (7) hide show
  1. data/.gitignore +2 -0
  2. data/Rakefile +13 -0
  3. data/Readme.textile +1 -0
  4. data/VERSION +1 -0
  5. data/lib/scrub.rb +44 -0
  6. data/scrub.gemspec +39 -0
  7. metadata +60 -0
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ .DS_Store
2
+ *.gem
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ begin
2
+ require 'jeweler'
3
+ Jeweler::Tasks.new do |gemspec|
4
+ gemspec.name = "scrub"
5
+ gemspec.summary = "Scrub files with ease and elbow grease"
6
+ gemspec.description = "Scrub files with ease and elbow grease"
7
+ gemspec.email = "matt@toastyapps.com"
8
+ gemspec.homepage = "http://github.com/toastyapps/scrub"
9
+ gemspec.authors = ["Matthew Mongeau"]
10
+ end
11
+ rescue LoadError
12
+ puts "Jeweler not available. Install it with: sudo gem install jeweler"
13
+ end
data/Readme.textile ADDED
@@ -0,0 +1 @@
1
+ Oh wait.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.0
data/lib/scrub.rb ADDED
@@ -0,0 +1,44 @@
1
+ module Scrub
2
+ class Scrubber
3
+ def initialize(&block)
4
+ config(&block) if block_given?
5
+ end
6
+
7
+ def config
8
+ @config = Scrubber::Config.new
9
+ yield @config
10
+ end
11
+
12
+ def crawl(data, splitter = /\n/)
13
+ lines = data.split(splitter)
14
+ while(line = lines.shift)
15
+ line.strip!
16
+ @config.matchers.each do |matcher, prok|
17
+ prok.call(line) if line =~ matcher
18
+ end
19
+ @config.between_matchers.each do |matcher, options|
20
+ if line =~ matcher
21
+ end_matcher, prok, conditions = options
22
+ next_line = nil
23
+ while(next_line = lines.shift) && (next_line !~ end_matcher)
24
+ prok.call(next_line) if next_line =~ conditions[:when]
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+
32
+ class Config
33
+ attr_accessor :matchers, :between_matchers
34
+ def initialize
35
+ @matchers, @between_matchers = {}, {}
36
+ end
37
+ def when matcher, &block
38
+ @matchers[matcher] = block
39
+ end
40
+ def between beginning_matcher, end_matcher, options = {}, &block
41
+ @between_matchers[beginning_matcher] = [end_matcher, block, {:when => /.*?/}.merge(options)]
42
+ end
43
+ end
44
+ end
data/scrub.gemspec ADDED
@@ -0,0 +1,39 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{scrub}
8
+ s.version = "0.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Matthew Mongeau"]
12
+ s.date = %q{2009-12-29}
13
+ s.description = %q{Scrub files with ease and elbow grease}
14
+ s.email = %q{matt@toastyapps.com}
15
+ s.files = [
16
+ ".gitignore",
17
+ "Rakefile",
18
+ "Readme.textile",
19
+ "VERSION",
20
+ "lib/scrub.rb",
21
+ "scrub.gemspec"
22
+ ]
23
+ s.homepage = %q{http://github.com/toastyapps/scrub}
24
+ s.rdoc_options = ["--charset=UTF-8"]
25
+ s.require_paths = ["lib"]
26
+ s.rubygems_version = %q{1.3.5}
27
+ s.summary = %q{Scrub files with ease and elbow grease}
28
+
29
+ if s.respond_to? :specification_version then
30
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
31
+ s.specification_version = 3
32
+
33
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
34
+ else
35
+ end
36
+ else
37
+ end
38
+ end
39
+
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrub
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Matthew Mongeau
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-12-29 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Scrub files with ease and elbow grease
17
+ email: matt@toastyapps.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - .gitignore
26
+ - Rakefile
27
+ - Readme.textile
28
+ - VERSION
29
+ - lib/scrub.rb
30
+ - scrub.gemspec
31
+ has_rdoc: true
32
+ homepage: http://github.com/toastyapps/scrub
33
+ licenses: []
34
+
35
+ post_install_message:
36
+ rdoc_options:
37
+ - --charset=UTF-8
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ version:
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: "0"
51
+ version:
52
+ requirements: []
53
+
54
+ rubyforge_project:
55
+ rubygems_version: 1.3.5
56
+ signing_key:
57
+ specification_version: 3
58
+ summary: Scrub files with ease and elbow grease
59
+ test_files: []
60
+