hparser 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +2 -8
- data/Gemfile +1 -1
- data/{README.md → README.rdoc} +1 -1
- data/VERSION +1 -1
- data/lib/hparser/inline/parser.rb +1 -9
- data/lib/hparser/parser.rb +1 -12
- data/lib/hparser/util/parser.rb +22 -0
- metadata +6 -6
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/{README.md → README.rdoc}
RENAMED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
@@ -20,15 +20,7 @@ module HParser
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.default_parser
|
23
|
-
|
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
|
data/lib/hparser/parser.rb
CHANGED
@@ -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
|
-
|
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
|
|
data/lib/hparser/util/parser.rb
CHANGED
@@ -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.
|
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:
|
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.
|
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:
|
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:
|
144
|
+
hash: 1601111818909404423
|
145
145
|
requirements: []
|
146
146
|
rubyforge_project:
|
147
|
-
rubygems_version: 1.8.
|
147
|
+
rubygems_version: 1.8.23.2
|
148
148
|
signing_key:
|
149
149
|
specification_version: 3
|
150
150
|
summary: Hatena Syntax parser for Ruby
|