cardname 0.9.6 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5fb31e3ad01ab125ee18e12a2bcb6b80dbbb9b348cbc264f7faa87e5cddc78b7
4
- data.tar.gz: 129176287f851f68fa1ac6f62c7529555df19e58e0bd5396aa19a18cc8c795fd
3
+ metadata.gz: da9b4a6b3d8ecfa150c732ef2bdba888f626b7e51c7230755ee2e93a2e61cde9
4
+ data.tar.gz: cdb0675cb1f3ab97d7df2d1ed8f5cf54f73e00fe16c1302da5cea5881b45938f
5
5
  SHA512:
6
- metadata.gz: c5fb5f5fbe13239b56f36d565e034e1bdb47a426f489a9b06e4a560955f0a09dab5586537e797526ca70b59b13f2fec1c98faf657b1a5c2fff8b32403f6de149
7
- data.tar.gz: 8eeda3c1e9a752cb661d22201f8a958748fa68d887d96f46f225f8059b8c6ff502fd20c697a25a9e6b96b79cde0026026638dec5814678c7080dd2798674181d
6
+ metadata.gz: 045012fd80276a3ae92bdc2597664cdc7e0116500fd486443375fff0b7cb27c7ec5b4fd9938671ea36479b4df07539cb0597210f771613efcbedfed98c87f610
7
+ data.tar.gz: 1ea808887da019f345fe558c3e611cd21b4018ee19aa6e7bacb893565ae81a141aab70078c66392c34533da6b606a5ed55015f72ac9903732228c78bfbc1c21c
@@ -1,6 +1,5 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
- require "active_support/configurable"
4
3
  require "active_support/inflector"
5
4
  require "htmlentities"
6
5
 
@@ -19,22 +18,22 @@ class Cardname < String
19
18
 
20
19
  OK4KEY_RE = '\p{Word}\*'
21
20
 
22
- include ActiveSupport::Configurable
21
+ cattr_accessor :joint, :banned_array, :var_re, :uninflect, :params,
22
+ :session, :stabilize
23
23
 
24
- config_accessor :joint, :banned_array, :var_re, :uninflect, :params,
25
- :session, :stabilize
26
-
27
- Cardname.joint = "+"
28
- Cardname.banned_array = []
29
- Cardname.var_re = /\{([^\}]*\})\}/
30
- Cardname.uninflect = :singularize
31
- Cardname.stabilize = false
24
+ self.joint = "+"
25
+ self.banned_array = []
26
+ self.var_re = /\{([^\}]*\})\}/
27
+ self.uninflect = :singularize
28
+ self.stabilize = false
32
29
 
33
30
  JOINT_RE = Regexp.escape joint
34
31
 
35
- @@cache = {}
36
-
37
32
  class << self
33
+ def cache
34
+ @cache ||= {}
35
+ end
36
+
38
37
  def new obj
39
38
  return obj if obj.is_a? self.class
40
39
 
@@ -43,11 +42,11 @@ class Cardname < String
43
42
  end
44
43
 
45
44
  def cached_name str
46
- @@cache[str]
45
+ cache[str]
47
46
  end
48
47
 
49
48
  def reset_cache str=nil
50
- str ? @@cache.delete(str) : @@cache = {}
49
+ str ? cache.delete(str) : @cache = {}
51
50
  end
52
51
 
53
52
  def stringify obj
@@ -97,7 +96,7 @@ class Cardname < String
97
96
  attr_reader :key
98
97
 
99
98
  def initialize str
100
- @@cache[str] = super str.strip.encode("UTF-8")
99
+ self.class.cache[str] = super str.strip.encode("UTF-8")
101
100
  end
102
101
 
103
102
  def s
@@ -64,7 +64,7 @@ class Cardname
64
64
  end
65
65
  end
66
66
 
67
- def absolute context, args={}
67
+ def absolute context
68
68
  context = (context || "").to_name
69
69
  new_parts = absolutize_contextual_parts context
70
70
  return "" if new_parts.empty?
@@ -100,8 +100,7 @@ class Cardname
100
100
  end
101
101
 
102
102
  def user_part part
103
- name_proc = self.class.session
104
- name_proc ? name_proc.call : part
103
+ self.class.session || part
105
104
  end
106
105
 
107
106
  def ordinal_part pos, context
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cardname
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
8
8
  - Philipp Kühl
9
9
  - Gerry Gleason
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-06-03 00:00:00.000000000 Z
13
+ date: 2020-09-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -61,7 +61,7 @@ licenses:
61
61
  - GPL-2.0
62
62
  - GPL-3.0
63
63
  metadata: {}
64
- post_install_message:
64
+ post_install_message:
65
65
  rdoc_options:
66
66
  - "--main"
67
67
  - README.rdoc
@@ -80,8 +80,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  requirements: []
83
- rubygems_version: 3.0.6
84
- signing_key:
83
+ rubygems_version: 3.0.3
84
+ signing_key:
85
85
  specification_version: 4
86
86
  summary: Card names without all the cards
87
87
  test_files: []