hparser 0.4.0 → 0.4.1

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.
data/.travis.yml CHANGED
@@ -1,11 +1,5 @@
1
1
  rvm:
2
2
  - 1.8.7
3
- - 1.9.2
4
3
  - 1.9.3
5
- - rbx-2.0
6
- - jruby
7
- - ruby-head
8
- - ree
9
- notifications:
10
- email:
11
- - hotchpotch@gmail.com
4
+ - 2.0.0
5
+ - 2.1.2
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
@@ -1,4 +1,4 @@
1
- =Hatena Format Parser
1
+ = Hatena Format Parser
2
2
 
3
3
  == Description
4
4
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
@@ -20,15 +20,7 @@ module HParser
20
20
  end
21
21
 
22
22
  def self.default_parser
23
- parser = []
24
- ObjectSpace.each_object(Class){|klass|
25
- if klass.include?(HParser::Inline::Collectable) then
26
- parser.push klass
27
- end
28
- }
29
- parser.sort{|a,b|
30
- a <=> b or -(b <=> a).to_i
31
- }
23
+ AllParser.includes(HParser::Inline::Collectable)
32
24
  end
33
25
 
34
26
  private
@@ -58,18 +58,7 @@ module HParser
58
58
  # This method collect all classes/modules which include
59
59
  # HParser::Block::Collectable. And sorting those by <=>.
60
60
  def self.default_parser
61
- parser = []
62
- ObjectSpace.each_object(Class){|klass|
63
- if klass.include?(HParser::Block::Collectable) then
64
- parser.push klass
65
- end
66
- }
67
-
68
- # sorting parser.
69
- # e.g. Parser P should be after any other parser.
70
- parser.sort{|a,b|
71
- a <=> b or -(b <=> a).to_i
72
- }
61
+ AllParser.includes(HParser::Block::Collectable)
73
62
  end
74
63
  end
75
64
 
@@ -69,6 +69,28 @@ module HParser
69
69
  @proc.call(*args)
70
70
  end
71
71
  end
72
+
73
+ class AllParser
74
+ # Retutrn array of all usable parser.
75
+ #
76
+ # This method collect all classes/modules which include
77
+ # mod module. And sorting those by <=>.
78
+ def self.includes(mod)
79
+ parser = []
80
+ ObjectSpace.each_object(Class){|klass|
81
+ next if klass.name.nil? || !klass.name.start_with?('HParser::')
82
+ if klass.include?(mod) then
83
+ parser.push klass
84
+ end
85
+ }
86
+
87
+ # sorting parser.
88
+ # e.g. Parser P should be after any other parser.
89
+ parser.sort{|a,b|
90
+ a <=> b or -(b <=> a).to_i
91
+ }
92
+ end
93
+ end
72
94
  end
73
95
  end
74
96
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-09-22 00:00:00.000000000 Z
14
+ date: 2014-08-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -55,7 +55,7 @@ files:
55
55
  - .travis.yml
56
56
  - ChangeLog
57
57
  - Gemfile
58
- - README.md
58
+ - README.rdoc
59
59
  - Rakefile
60
60
  - VERSION
61
61
  - hparser.gemspec
@@ -132,7 +132,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
132
132
  version: '0'
133
133
  segments:
134
134
  - 0
135
- hash: -2893136199592784256
135
+ hash: 1601111818909404423
136
136
  required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  none: false
138
138
  requirements:
@@ -141,10 +141,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  version: '0'
142
142
  segments:
143
143
  - 0
144
- hash: -2893136199592784256
144
+ hash: 1601111818909404423
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 1.8.24
147
+ rubygems_version: 1.8.23.2
148
148
  signing_key:
149
149
  specification_version: 3
150
150
  summary: Hatena Syntax parser for Ruby