output_mode 1.0.0 → 1.1.1

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: 459750a9a32c10353ffca23bcf3f9aa1bdb7da651570a324e82ba224c260df87
4
- data.tar.gz: 5a1661e01600478c767d79ad27b2b499440f3d610d4255088c7c76fff0842e28
3
+ metadata.gz: c5a9cfc28a765bc0e31db2d2247f346f127cf99c4f4e630048b4882a539c1a03
4
+ data.tar.gz: 168a9b20db06828042673f7b4826f77367a10d283d2212a20d88eca3232fcde4
5
5
  SHA512:
6
- metadata.gz: 4bddfb1d70102c00543a73d6d2bdd56dfcd7f248fd0ea57b222dc428bb1cb6928168592663f07c7bd5d18e22a16ae70af59dc2fbf5281de19004971cb9b26737
7
- data.tar.gz: 94d113f12f084cf82a29b4a0f1e8528c3dbd8aa2138237d4dcb5ecbf8cc24352ab25e0528f6edb23a501dc2bdcec1e729698df7bb3f643d2666f8008ff0ece85
6
+ metadata.gz: bbefcfef7c8d46b95113b0877e84de60f852b8c3bac4d74575414215235796195c4f8447044ee92db11029e9edbfc269f092776c69e714fc8d91fc43319230bd
7
+ data.tar.gz: 3ff9cc52f21ab132ae2a673100354ff7e84eee824388315abf5563aeb181b35f82920d778e7e89bfbaa1e832bd31d377ce2865e1f5c73d5e88f7d6bafcdbfe6f
@@ -1,7 +1,3 @@
1
- This project is partially dual licensed under BSD-2-Clause OR 0BSD. Source code originating from a BSD-2-Clause licensed file must comply with terms contained within the license header block. Source code originating from files without a license header block maybe redistributed under either license.
2
-
3
- The following is a copy of the BSD-2-Clause license:
4
-
5
1
  Copyright 2020 William McCumstie
6
2
 
7
3
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -11,8 +7,3 @@ Redistribution and use in source and binary forms, with or without modification,
11
7
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12
8
 
13
9
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
-
15
- The following is a copy of the 0BSD license:
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
-
@@ -83,28 +83,36 @@ module OutputMode
83
83
 
84
84
  # Handles the dynamic +<query>?+ and +<explicit-negation>!+ methods
85
85
  #
86
- # The +<query>?+ methods check if the mode has been set on the object. If
87
- # +query+ is a defined mode, then the value is directly pulled from #{modes}.
88
- # Undefined modes will return +false+.
89
- #
90
- # The +<explicit-negation>!+ methods are similar to queries, but undefined modes
91
- # will return +true+. This means +<explicit-negation>!+ methods only return +false+
92
- # if the +explicit-negation+ mode has been set to +false+ in {#modes}.
93
- #
94
86
  # @return [Boolean] The result of the query or explicit-negation
95
- # @raises [NoMethodError] All other method calls
96
- def method_missing(s, *a, &b)
87
+ # @raise [NoMethodError] All other method calls
88
+ def method_missing(s, *args, &b)
97
89
  mode = s[0..-2].to_sym
98
90
  case method_char(s)
99
91
  when '?'
100
- modes.fetch(mode, false)
92
+ ifnone = (args.length > 0 ? args.first : false)
93
+ modes.fetch(mode, ifnone)
101
94
  when '!'
102
- modes.fetch(mode, true)
95
+ send(:"#{mode}?", true)
103
96
  else
104
97
  super
105
98
  end
106
99
  end
107
100
 
101
+ # @!method mode?(ifnone = false)
102
+ # This is a dynamic method for check if an arbitrary +mode+ has been set. It will
103
+ # return the associated value if the +mode+ has been defined in {#modes}.
104
+ #
105
+ # Otherwise it will return the +ifnone+ value
106
+ # @return [Boolean] the associated value if +mode+ has been defined
107
+ # @return otherwise return the +ifnone+ value
108
+ #
109
+ # @!method mode!
110
+ # Older syntax that returns +true+ if the +mode+ has not been defined. Otherwise
111
+ # the same as {#mode?}
112
+ #
113
+ # @return [Boolean]
114
+ # @deprecated Please use the newer +mode?(true)+ syntax
115
+
108
116
  # Responds +true+ for valid dynamic methods
109
117
  # @param [Symbol] s The method to be tested
110
118
  # @return [Boolean] The truthiness of the underlining call to {#method_char}
@@ -15,6 +15,7 @@ module OutputMode
15
15
  def register_callable(header:, verbose: nil, &b)
16
16
  super(modes: { verbose: verbose }, header: header, &b)
17
17
  end
18
+ alias_method :register_column, :register_callable
18
19
 
19
20
  # Creates an new +output+ from the verbosity flag. This method only uses
20
21
  # +$stdout+ as part of it's output class discovery logic. It does not
@@ -17,6 +17,7 @@ module OutputMode
17
17
  def register_callable(header:, verbose: nil, &b)
18
18
  super(modes: { verbose: verbose }, header: header, &b)
19
19
  end
20
+ alias_method :register_attribute, :register_callable
20
21
 
21
22
  # Creates an new +output+ from the verbosity flag. This method only uses
22
23
  # +$stdout+ as part of it's output class discovery logic. It does not
@@ -25,5 +25,5 @@
25
25
  #==============================================================================
26
26
 
27
27
  module OutputMode
28
- VERSION = "1.0.0"
28
+ VERSION = "1.1.1"
29
29
  end
@@ -31,6 +31,7 @@ require "output_mode/version"
31
31
  Gem::Specification.new do |spec|
32
32
  spec.name = "output_mode"
33
33
  spec.version = OutputMode::VERSION
34
+ spec.licenses = ['BSD-2-Clause']
34
35
  spec.authors = ["William McCumsite"]
35
36
  spec.email = ["openlicense.williams@gmail.com"]
36
37
 
@@ -48,9 +49,9 @@ Gem::Specification.new do |spec|
48
49
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
49
50
  spec.require_paths = ["lib"]
50
51
 
51
- spec.add_runtime_dependency 'tty-table', '~> 0.11'
52
- spec.add_runtime_dependency 'pastel', '~> 0.7'
53
- spec.add_runtime_dependency 'tty-color', '~> 0.5'
52
+ spec.add_runtime_dependency 'tty-table', '>= 0.11'
53
+ spec.add_runtime_dependency 'pastel', '>= 0.7'
54
+ spec.add_runtime_dependency 'tty-color', '>= 0.5'
54
55
 
55
56
  spec.add_development_dependency "bundler", "~> 2.0"
56
57
  spec.add_development_dependency "rake", ">= 12.3.3"
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: output_mode
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - William McCumsite
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-30 00:00:00.000000000 Z
11
+ date: 2020-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-table
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.11'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.11'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pastel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.7'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.7'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: tty-color
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.5'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.5'
55
55
  - !ruby/object:Gem::Dependency
@@ -141,7 +141,8 @@ files:
141
141
  - lib/output_mode/version.rb
142
142
  - output_mode.gemspec
143
143
  homepage: https://github.com/WilliamMcCumstie/output_mode
144
- licenses: []
144
+ licenses:
145
+ - BSD-2-Clause
145
146
  metadata:
146
147
  homepage_uri: https://github.com/WilliamMcCumstie/output_mode
147
148
  post_install_message: