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 +4 -4
- data/README.md +2 -2
- data/lib/constantin/option.rb +5 -2
- data/lib/constantin/version.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 28ec6588be165154e41c0f8cee071c676c73903c8fc569f36f370e927a6c44d8
         | 
| 4 | 
            +
              data.tar.gz: 92e6c7c92196884b0b5ab0481177e4e174f924e9fe76bde75849cacb1f4fcec3
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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  | 
| 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:: | 
| 20 | 
            +
            class Country < Constantin::Option
         | 
| 21 21 | 
             
              define_options 'US', 'PH', 'JP'
         | 
| 22 22 | 
             
              define_options { NZ: "New Zealand"}
         | 
| 23 23 | 
             
            end
         | 
    
        data/lib/constantin/option.rb
    CHANGED
    
    | @@ -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  | 
| 32 | 
            -
                     | 
| 34 | 
            +
                  def define_option_group(name)
         | 
| 35 | 
            +
                    const_set(transform_key(name), yield)
         | 
| 33 36 | 
             
                  end
         | 
| 34 37 |  | 
| 35 38 | 
             
                  def add_value(val)
         | 
    
        data/lib/constantin/version.rb
    CHANGED
    
    
    
        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. | 
| 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- | 
| 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. | 
| 114 | 
            +
            rubygems_version: 3.1.2
         | 
| 115 115 | 
             
            signing_key: 
         | 
| 116 116 | 
             
            specification_version: 4
         | 
| 117 117 | 
             
            summary: Handy way to handle constants.
         |