smartname 0.1.2 → 0.1.3
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/Gemfile +1 -1
- data/Gemfile.lock +5 -5
- data/VERSION +1 -1
- data/lib/smart_name.rb +8 -6
- metadata +4 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activesupport (3.2.
|
4
|
+
activesupport (3.2.9)
|
5
5
|
i18n (~> 0.6)
|
6
6
|
multi_json (~> 1.0)
|
7
7
|
diff-lcs (1.1.3)
|
8
8
|
git (1.2.5)
|
9
9
|
htmlentities (4.3.1)
|
10
10
|
i18n (0.6.1)
|
11
|
-
jeweler (1.8.
|
11
|
+
jeweler (1.8.4)
|
12
12
|
bundler (~> 1.0)
|
13
13
|
git (>= 1.2.5)
|
14
14
|
rake
|
15
15
|
rdoc
|
16
16
|
json (1.7.5)
|
17
|
-
multi_json (1.3.
|
18
|
-
rake (0.
|
17
|
+
multi_json (1.3.7)
|
18
|
+
rake (10.0.2)
|
19
19
|
rdoc (3.12)
|
20
20
|
json (~> 1.4)
|
21
21
|
rspec (2.8.0)
|
@@ -32,7 +32,7 @@ PLATFORMS
|
|
32
32
|
|
33
33
|
DEPENDENCIES
|
34
34
|
activesupport
|
35
|
-
bundler (~> 1.1
|
35
|
+
bundler (~> 1.1)
|
36
36
|
htmlentities (~> 4.3.0)
|
37
37
|
jeweler (~> 1.8.3)
|
38
38
|
rdoc (~> 3.12)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/smart_name.rb
CHANGED
@@ -24,7 +24,7 @@ class SmartName < Object
|
|
24
24
|
SmartName.formal_joint = " <span class=\"wiki-joint\">#{SmartName.joint}</span> " #let's get rid of this
|
25
25
|
SmartName.banned_array = [ '/', '~', '|' ]
|
26
26
|
SmartName.name_attribute = :cardname
|
27
|
-
SmartName.var_re = /\{([^\}]
|
27
|
+
SmartName.var_re = /\{([^\}]*\})\}/
|
28
28
|
SmartName.uninflect = :singularize
|
29
29
|
|
30
30
|
JOINT_RE = Regexp.escape SmartName.joint
|
@@ -162,6 +162,8 @@ class SmartName < Object
|
|
162
162
|
|
163
163
|
|
164
164
|
#~~~~~~~~~~~~~~~~~~~ TRAITS / STARS ~~~~~~~~~~~~~~~~~~~
|
165
|
+
|
166
|
+
#all the below seems pretty wagn-specific
|
165
167
|
|
166
168
|
def star?() simple? and '*' == s[0,1] end
|
167
169
|
def rstar?() right and '*' == right[0,1] end
|
@@ -170,15 +172,15 @@ class SmartName < Object
|
|
170
172
|
junction? && begin
|
171
173
|
right_key = right_name.key
|
172
174
|
!!traitlist.find do |codename|
|
173
|
-
|
174
|
-
|
175
|
+
card_id = SmartName.codes[ codename ] and card = SmartName.lookup[ card_id ] and
|
176
|
+
card.send(SmartName.name_attribute).key == right_key
|
175
177
|
end
|
176
178
|
end
|
177
179
|
end
|
178
180
|
|
179
181
|
def trait_name tag_code
|
180
|
-
|
181
|
-
[ self,
|
182
|
+
card_id = SmartName.codes[ tag_code ] and card = SmartName.lookup[ card_id ] and
|
183
|
+
[ self, card.send(SmartName.name_attribute) ].to_name
|
182
184
|
end
|
183
185
|
|
184
186
|
def trait tag_code
|
@@ -277,7 +279,7 @@ class SmartName < Object
|
|
277
279
|
def self.substitute! str, hash
|
278
280
|
hash.keys.each do |var|
|
279
281
|
str.gsub! SmartName.var_re do |x|
|
280
|
-
|
282
|
+
hash[var.to_sym]
|
281
283
|
end
|
282
284
|
end
|
283
285
|
str
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartname
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -83,7 +83,7 @@ dependencies:
|
|
83
83
|
requirements:
|
84
84
|
- - ~>
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: 1.1
|
86
|
+
version: '1.1'
|
87
87
|
type: :development
|
88
88
|
prerelease: false
|
89
89
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -91,7 +91,7 @@ dependencies:
|
|
91
91
|
requirements:
|
92
92
|
- - ~>
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: 1.1
|
94
|
+
version: '1.1'
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
96
|
name: jeweler
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
segments:
|
145
145
|
- 0
|
146
|
-
hash:
|
146
|
+
hash: 553542822797898522
|
147
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
148
|
none: false
|
149
149
|
requirements:
|