constantin 0.1.2 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb52af75a34cd08d2ab154a4d70efe5318b6ce706a355089c23be235ec197409
4
- data.tar.gz: 2576c5344799bc654068fc1bb4b98b330ba0e863c9633de598f39f7f02d44874
3
+ metadata.gz: 28ec6588be165154e41c0f8cee071c676c73903c8fc569f36f370e927a6c44d8
4
+ data.tar.gz: 92e6c7c92196884b0b5ab0481177e4e174f924e9fe76bde75849cacb1f4fcec3
5
5
  SHA512:
6
- metadata.gz: ec0d99930caf38417f83f1ce19296f805d8d18f54ed2f11da71ee329d9912fd093c56117c9fb60b342e8d16cac827d80fe83f58aa781ac4b1fe3b60ba5fd23ee
7
- data.tar.gz: 41fdcf25eff731ef893fc4e5880110a52d0bc18ca750394f7526295b8065e3dc7c1e2801a4b7c087c694dda1618681f6d0707d32fa3aeb8b5a237f17dd7df770
6
+ metadata.gz: '0458425451c65bb60617ef13177a8d9da37fbf6d867494885fc2973704590c36b8069d7097744f4c5c3e42a9a042659cf6a689d7868949f8db42599659c5d7ec'
7
+ data.tar.gz: cfcf185ea0b030941a46adad951b64a31fa481e60a778946316b4094641a06c61df31ec7f26bd829f51a2fb33371e842c335f3ca2f30cf3b4f8bc9d1d5db821f
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Constantin
2
- A handy way to utilize constants especially on options.
2
+ A handy way to manage constants especially for options.
3
3
 
4
4
  ## Installation
5
5
 
@@ -17,7 +17,7 @@ And then execute:
17
17
 
18
18
  ```ruby
19
19
  # app/constants/country.rb
20
- class Country < Constantin::Constant
20
+ class Country < Constantin::Option
21
21
  define_options 'US', 'PH', 'JP'
22
22
  define_options { NZ: "New Zealand"}
23
23
  end
@@ -4,6 +4,9 @@ module Constantin
4
4
  # ex.
5
5
  # define_options('PH', 'TH', {'USA' => 'US'})
6
6
  #
7
+ # define_option_group 'ASIA' do
8
+ # [PH, TH]
9
+ # end
7
10
  class << self
8
11
  def define_options(*constants)
9
12
  # Transform to key value format
@@ -28,8 +31,8 @@ module Constantin
28
31
  const_set('ALL', all_values)
29
32
  end
30
33
 
31
- def define_group_option
32
- # TODO Group constants
34
+ def define_option_group(name)
35
+ const_set(transform_key(name), yield)
33
36
  end
34
37
 
35
38
  def add_value(val)
@@ -1,3 +1,3 @@
1
1
  module Constantin
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: constantin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jude_cali
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-06 00:00:00.000000000 Z
11
+ date: 2020-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  requirements: []
114
- rubygems_version: 3.0.3
114
+ rubygems_version: 3.1.2
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: Handy way to handle constants.