shellopts 2.0.12 → 2.0.13
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/lib/shellopts/program.rb +16 -3
- data/lib/shellopts/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8dd7a731b489dbf650e15549d9768469ae9d6c47c6dba3ae79f4d956fea069ab
         | 
| 4 | 
            +
              data.tar.gz: 4b71aff7ba350d4616a136580857a6acd840141ed0b7463034518dcf4ae4dada
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: bb5792606dd91f46b95fe786b509fd079697c87fd603c667e49740b365cafafa0cdc7b49a0a86c72cd014f9c2d88cdf74f096422e6099403042d8c34d35044b3
         | 
| 7 | 
            +
              data.tar.gz: d7f2637649b474741b70dd9334e25107586fe52eb4e4f9a289453699f334488fed60322a676ad20fcab2f0c993785ccdef89be4397055028e75d79795766b972
         | 
    
        data/lib/shellopts/program.rb
    CHANGED
    
    | @@ -45,12 +45,12 @@ module ShellOpts | |
| 45 45 |  | 
| 46 46 | 
             
                # These names can't be used as option or command names
         | 
| 47 47 | 
             
                RESERVED_OPTION_NAMES = %w(
         | 
| 48 | 
            -
                    is_a instance_eval instance_exec method_missing singleton_method_added
         | 
| 48 | 
            +
                    is_a to_h instance_eval instance_exec method_missing singleton_method_added
         | 
| 49 49 | 
             
                    singleton_method_removed singleton_method_undefined
         | 
| 50 50 | 
             
                )
         | 
| 51 51 |  | 
| 52 | 
            -
                # These methods can be overridden by an option or a command ( | 
| 53 | 
            -
                #  | 
| 52 | 
            +
                # These methods can be overridden by an option or a command (this constant
         | 
| 53 | 
            +
                # is not used - it is just for informational purposes)
         | 
| 54 54 | 
             
                OVERRIDEABLE_METHOD_NAMES = %w(
         | 
| 55 55 | 
             
                    subcommand subcommand! supercommand!
         | 
| 56 56 | 
             
                )
         | 
| @@ -96,6 +96,19 @@ module ShellOpts | |
| 96 96 | 
             
                  end
         | 
| 97 97 | 
             
                end
         | 
| 98 98 |  | 
| 99 | 
            +
                # Returns a hash of the given options if defined. Returns all options if no
         | 
| 100 | 
            +
                # options are given
         | 
| 101 | 
            +
                def to_h(*keys)
         | 
| 102 | 
            +
                  keys = ::Kernel::Array(keys).flatten
         | 
| 103 | 
            +
                  if keys.empty?
         | 
| 104 | 
            +
                    @__option_values__
         | 
| 105 | 
            +
                  else
         | 
| 106 | 
            +
                    keys.map { |key|
         | 
| 107 | 
            +
                      @__option_values__.key?(key) ? [key, @__option_values__[key]] : nil
         | 
| 108 | 
            +
                    }.compact.to_h
         | 
| 109 | 
            +
                  end
         | 
| 110 | 
            +
                end
         | 
| 111 | 
            +
             | 
| 99 112 | 
             
                # Subcommand identifier or nil if not present. #subcommand is often used in
         | 
| 100 113 | 
             
                # case statement to branch out to code that handles the given subcommand:
         | 
| 101 114 | 
             
                #
         | 
    
        data/lib/shellopts/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: shellopts
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 2.0. | 
| 4 | 
            +
              version: 2.0.13
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Claus Rasmussen
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2022-03 | 
| 11 | 
            +
            date: 2022-04-03 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: forward_to
         |