so_far_so_good 0.0.3 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: so_far_so_good
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-14 00:00:00.000000000 Z
11
+ date: 2014-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -122,10 +122,9 @@ files:
122
122
  - README.md
123
123
  - Rakefile
124
124
  - lib/so_far_so_good.rb
125
- - lib/so_far_so_good/clause.rb
126
- - lib/so_far_so_good/clauses.rb
125
+ - lib/so_far_so_good/subchapter.rb
126
+ - lib/so_far_so_good/subpart.rb
127
127
  - lib/so_far_so_good/version.rb
128
- - output.json
129
128
  - script/bootstrap
130
129
  - script/cibuild
131
130
  - script/console
@@ -133,10 +132,11 @@ files:
133
132
  - script/vendor
134
133
  - so_far_so_good.gemspec
135
134
  - test/helper.rb
136
- - test/so_far_so_good_clause_test.rb
137
- - test/so_far_so_good_clauses_test.rb
135
+ - test/so_far_so_good_subchapter_test.rb
136
+ - test/so_far_so_good_subpart_test.rb
138
137
  - test/so_far_so_good_test.rb
139
- - vendor/CFR-2010-title48-vol2-chap1-subchapH.xml
138
+ - vendor/CFR-2013-title48-vol2-chap1-subchapH.xml
139
+ - vendor/CFR-2013-title48-vol3-chap2-subchapH.xml
140
140
  homepage: https://github.com/benbalter/so_far_so_good
141
141
  licenses:
142
142
  - MIT
@@ -163,6 +163,6 @@ specification_version: 4
163
163
  summary: ''
164
164
  test_files:
165
165
  - test/helper.rb
166
- - test/so_far_so_good_clause_test.rb
167
- - test/so_far_so_good_clauses_test.rb
166
+ - test/so_far_so_good_subchapter_test.rb
167
+ - test/so_far_so_good_subpart_test.rb
168
168
  - test/so_far_so_good_test.rb
@@ -1,58 +0,0 @@
1
- module SoFarSoGood
2
- class Clauses
3
- class << self
4
-
5
- HEADINGS = ["Clause", "Description"]
6
-
7
- def numbers(options = {})
8
- @numbers ||= clauses(options).map { |c| c.number }
9
- end
10
-
11
- def subjects(options = {})
12
- @subjects ||= clauses(options).map { |c| c.subject }
13
- end
14
- alias_method :descriptions, :subjects
15
-
16
- def clauses(options = {})
17
- options = {:exclude_reserved => false}.merge(options)
18
- @clauses ||= sections.map { |node| SoFarSoGood::Clause.new(node) }
19
- if options[:exclude_reserved]
20
- @clauses.reject { |c| c.reserved }
21
- else
22
- @clauses
23
- end
24
- end
25
- alias_method :list, :clauses
26
-
27
- def to_md(options = {})
28
- options = {:exclude_reserved => false, :links => false}.merge(options)
29
- rows = clauses(options).map { |c| [ options[:links] ? "[#{c.number}](#{c.link})" : c.number , c.subject] }
30
- Terminal::Table.new(:rows => rows, :style => { :border_i => "|" }, :headings => HEADINGS).to_s
31
- end
32
-
33
- def to_json(options = {})
34
- clauses(options).to_json(options)
35
- end
36
-
37
- def [](number)
38
- clauses.find { |c| c.number == number }
39
- end
40
-
41
- private
42
-
43
- def source_path
44
- @source_path ||= File.expand_path "CFR-2010-title48-vol2-chap1-subchapH.xml", SoFarSoGood.vendor_directory
45
- end
46
-
47
- def doc
48
- @doc ||= Nokogiri::XML(File.open(source_path)) do |config|
49
- config.noblanks.nonet
50
- end
51
- end
52
-
53
- def sections
54
- @subpart ||= doc.css("PART SUBPART")[4].children.css("SECTION")
55
- end
56
- end
57
- end
58
- end