polyrex-headings 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/polyrex-headings.rb +27 -0
  2. metadata +64 -0
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: polyrex-headings.rb
4
+
5
+ require 'polyrex'
6
+
7
+ class PolyrexHeadings
8
+
9
+ attr_reader :to_polyrex
10
+
11
+ def initialize(raw_s)
12
+
13
+ summary, *s = raw_s.gsub(/(-+\n)\n/,'\1').partition(/[^\n]+\n-+/)
14
+
15
+ a = s.join.lines.chunk{|x| x != "\n" }.map do |record, x|
16
+ if record then
17
+ head = x.shift
18
+ x.shift
19
+ [head] + x.map{|y| ' ' + y}
20
+ end
21
+ end
22
+
23
+ summary.sub!(/^(<\?)(ph|polyrex-headings)/,'\1polyrex')
24
+ @to_polyrex = Polyrex.new.parse(summary + a.join)
25
+ end
26
+
27
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: polyrex-headings
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - James Robertson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-11-09 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: polyrex
17
+ prerelease: false
18
+ requirement: &id001 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ type: :runtime
25
+ version_requirements: *id001
26
+ description:
27
+ email:
28
+ executables: []
29
+
30
+ extensions: []
31
+
32
+ extra_rdoc_files: []
33
+
34
+ files:
35
+ - lib/polyrex-headings.rb
36
+ homepage:
37
+ licenses: []
38
+
39
+ post_install_message:
40
+ rdoc_options: []
41
+
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ requirements: []
57
+
58
+ rubyforge_project:
59
+ rubygems_version: 1.8.23
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: polyrex-headings
63
+ test_files: []
64
+