skn_utils 5.0.0 → 5.0.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
  SHA1:
3
- metadata.gz: 3697c08bd7a516dbb2a55b859f12b18a1cd7e9ca
4
- data.tar.gz: e38dac4af4d7e5da6dd5096b513e95e407784390
3
+ metadata.gz: 909a823062d4f9798fcdd311a66150ba6ab8d9c7
4
+ data.tar.gz: b4fb998ff089836a7b7760ddc1741527338272d4
5
5
  SHA512:
6
- metadata.gz: 2223a7fb6597e014f2b94135f1c8626c12a798f3c6193cb1909fa887cc9aeb8ba311580f147f6289e18872b1961e8c431679d288d5cc88ae7a377c63aa39194a
7
- data.tar.gz: 5ad2921a2d3cf465457f0f24f327a2286daff274cc9975e7f3d42fc46d9946074674a0ff8bd93863ab5e8001b66bff831292519f64899908bb4e2c6d7e36d798
6
+ metadata.gz: 68d2d352112cdfc76966e4b868639fc855f757679c8d4fcddb016f6af7ae8a9f82dd901034fefb9fad107322e9151174e6713e78fce46b816d0c4290832b0934
7
+ data.tar.gz: 4dcdde155be60d80582ff95e398c4717771f093f488fbd498665806f5de6a1b63af52de0f05b6c38e4c2bfac3d2cfa77739b0765efaf243e57799d7a067692cf
data/README.md CHANGED
@@ -43,6 +43,8 @@ Ruby's Hash object is already extremely flexible, even more so with the addition
43
43
  There are many more use cases for Ruby's Hash that this gem just makes easier to implement.
44
44
 
45
45
  #### Available Classes
46
+ * SknSuccess
47
+ # SknFailure
46
48
  * SknSettings
47
49
  * SknUtils::Configurable
48
50
  * SknUtils::EnvStringHandler
@@ -55,6 +57,10 @@ There are many more use cases for Ruby's Hash that this gem just makes easier to
55
57
  * SknUtils::CoreObjectExtensions
56
58
 
57
59
  ## History
60
+ 10/12/2018 V5.0.1
61
+ Added SknSuccess/SknFailure as value object to carry return codes vs exceptions
62
+ Modified Configurable to mimic Rails.env, Rails.root, and Rails.logger
63
+
58
64
  10/2/2018 V5.0.0
59
65
  Modified SknContainer (IoC) to only use #register and #resolve as it's public API.
60
66
  - Inspired by: [Andrew Holland](http://cv.droppages.com)
@@ -127,9 +133,11 @@ There are many more use cases for Ruby's Hash that this gem just makes easier to
127
133
 
128
134
  SknSettings # Multi-level application Configuration class, Key/Value Container with Dot/Hash notiation support.
129
135
 
130
- SknUtils::Configurable # Basic one-level configuration settings module for Applications and or Gems
136
+ SknUtils::Configurable # Basic one-level configuration Applications classes or modules. Adds MyClass.root,MyClass.env, and MyClass.logger, with MyClass.config.<user_attrs>
137
+
131
138
  SknContainer # Basic Key/Value container which #registers and #resolves procs, classes, and/or object
132
-
139
+ SknSuccess # Three attribute value containers for return codes -- #success, #message, #value
140
+ SknFailure # Three attribute value containers for return codes -- #success, #message, #value
133
141
 
134
142
  ## Configuration Options
135
143
  None required other than initialization hash
@@ -139,7 +147,7 @@ There are many more use cases for Ruby's Hash that this gem just makes easier to
139
147
  SknContainer is global constant containing an initialized Object of Concurrent::Hash using defaults with additional methods.
140
148
  Returns the keyed value as the original instance/value or if provided a proc the result of calling that proc.
141
149
  To register a class or object for global retrieval, use the following API. Also review the RSpecs for additional useage info.
142
- #register(key, contents = nil, options = {}, &block)
150
+ #register(key, contents = nil, options = {})
143
151
  - example:
144
152
  SknContainer.register(:some_klass, MyClass) -- class as value
145
153
  SknContainer.register(:the_instance, MyClass.new) -- Object Instance as value
@@ -163,7 +171,7 @@ There are many more use cases for Ruby's Hash that this gem just makes easier to
163
171
 
164
172
 
165
173
  ## Public Methods: SknSettings ONLY
166
- SknSettings is global constant containing an initialized Object of SknUtils::SknConfiguration using defaults
174
+ SknSettings is global constant containing an initialized Object of SknUtils::Configuration using defaults
167
175
  To change the 'development'.yml default please use the following method early or in the case of Rails in 'application.rb
168
176
  #load_config_basename!(config_name) -- Where config_name is the name of yml files stored in the `./config/settings` directory
169
177
  #config_path!(path) -- Where path format is './<dirs>/', default is: './config/'
data/lib/skn_container.rb CHANGED
@@ -29,6 +29,12 @@
29
29
  # SknContainer.register(:person_repository, -> { PersonRepository.new }, call: true )
30
30
  #
31
31
  # SknContainer.resolve(:person_repository).first
32
+ #
33
+ ## Outside Example
34
+ # SknContainer.register(:some_block, {call: false}) {|str| str.upcase }
35
+ # #
36
+ # SknContainer.resolve(:some_block).call("hello")
37
+ # # ==> "HELLO"
32
38
  ##
33
39
 
34
40
  # This creates a global constant (and singleton) wrapping a Hash
@@ -0,0 +1,25 @@
1
+ # ##
2
+ # Bad Result
3
+
4
+ class SknFailure
5
+ attr_reader :value, :success, :message
6
+
7
+ def self.call(*args)
8
+ new(*args)
9
+ end
10
+
11
+ def initialize(*args)
12
+ val, rc, msg = *args
13
+ # puts "#{self.class.name} => val:#{val}, rc:#{rc}, msg:#{msg}, args:#{args}"
14
+
15
+ if args.size.eql?(2) and not ['TrueClass','FalseClass'].include?(rc.class.name)
16
+ msg = rc
17
+ rc = false
18
+ end
19
+
20
+ @value = val || "Failure"
21
+ @success = !!rc
22
+ @message = msg || ''
23
+ end
24
+
25
+ end
data/lib/skn_settings.rb CHANGED
@@ -7,5 +7,5 @@
7
7
  ##
8
8
 
9
9
  # This creates a global constant (and singleton) with a defaulted configuration
10
- class << (SknSettings = SknUtils::SknConfiguration.new())
10
+ class << (SknSettings = SknUtils::Configuration.new())
11
11
  end
@@ -0,0 +1,25 @@
1
+ # ##
2
+ # Good Result
3
+
4
+ class SknSuccess
5
+ attr_reader :value, :success, :message
6
+
7
+ def self.call(*args)
8
+ new(*args)
9
+ end
10
+
11
+ def initialize(*args)
12
+ val, rc, msg = *args
13
+ # puts "#{self.class.name} => val:#{val}, rc:#{rc}, msg:#{msg}, args:#{args}"
14
+
15
+ if args.size.eql?(2) and not ['TrueClass','FalseClass', 'NilClass'].include?(rc.class.name)
16
+ msg = rc
17
+ rc = true
18
+ end
19
+
20
+ @value = val || "Success"
21
+ @success = !!rc || true
22
+ @message = msg || ''
23
+ end
24
+
25
+ end
data/lib/skn_utils.rb CHANGED
@@ -20,12 +20,14 @@ require 'skn_utils/result_bean'
20
20
  require 'skn_utils/page_controls'
21
21
  require 'skn_utils/null_object'
22
22
  require 'skn_utils/notifier_base'
23
- require 'skn_utils/skn_configuration'
23
+ require 'skn_utils/configuration'
24
24
  require 'skn_utils/configurable'
25
25
 
26
26
  require 'skn_hash'
27
27
  require 'skn_container'
28
28
  require 'skn_settings'
29
+ require 'skn_success'
30
+ require 'skn_failure'
29
31
 
30
32
  module SknUtils
31
33
 
@@ -4,46 +4,83 @@
4
4
  #
5
5
 
6
6
  module SknUtils
7
-
8
- # In the end, we have got ourselves a pretty neat module for making an arbitrary
9
- # class configurable and then specifying those configuration values using a clean
10
- # and simple DSL that also lets us reference one configuration attribute
11
- # from another:
12
- #
13
- #################
14
- # Inside Target component
15
- #################
16
- # class MyApp
17
- # include SknUtils::Configurable.with(:app_id, :title, :cookie_name)
18
- # # ...
19
- # end
20
- #
21
- #################
22
- # Inside Initializer
23
- #################
24
- # MyApp.configure do
25
- # app_id "my_app"
26
- # title "My App"
27
- # cookie_name { "#{app_id}_session" }
28
- # end
29
- #
30
- #################
31
- # Usage:
32
- #################
33
- # MyApp.config.app_id # ==> "my_app"
34
- #
35
- # Here is the final version of the module that implements our DSL—a total of 36 lines of code:
7
+ # For making an arbitrary class configurable and then specifying those configuration values using a clean
8
+ # and simple DSL that also lets us reference one configuration attribute from another
9
+ #
10
+ #################
11
+ # Inside Target component
12
+ #################
13
+ # class MyApp
14
+ # include SknUtils::Configurable.with(:app_id, :title, :cookie_name) # or {root_enable: false})
15
+ # # ... default=true for root|env|logger
16
+ # end
17
+ #
18
+ #################
19
+ # Inside Initializer
20
+ #################
21
+ # MyApp.configure do
22
+ # app_id "my_app"
23
+ # title "My App"
24
+ # cookie_name { "#{app_id}_session" }
25
+ # end
26
+ #
27
+ #################
28
+ # During Definition
29
+ #################
30
+ # class MyApp
31
+ # include SknUtils::Configurable.with(:app_id, :title, :cookie_name, {root_enable: true})
32
+ # # ...
33
+ # configure do
34
+ # app_id "my_app"
35
+ # title "My App"
36
+ # cookie_name { "#{app_id}_session" }
37
+ # end
38
+ #
39
+ # self.logger = Logger.new
40
+ # self.env = ENV.fetch('RACK_ENV', 'development')
41
+ # self.root = Dir.pwd
42
+ # end
43
+ #
44
+ #################
45
+ # Usage:
46
+ #################
47
+ # MyApp.config.app_id # ==> "my_app"
48
+ # MyApp.logger # ==> <Logger.class>
49
+ # MyApp.env.test? # ==> true
50
+ #
51
+ # ###############
52
+ # Syntax
53
+ # ###############
54
+ # Main Class Attrs
55
+ # - root = application rood directory as Pathname
56
+ # - env = string value from RACK_ENV
57
+ # - logger = Assiigned Logger instance
58
+ # #with(*user_attrs, enable_root: true|false) - defaults to enable of Main Class Attrs
59
+ # ##
60
+ # User-Defined Attrs
61
+ # MyThing.with(:name1, :name2, ...)
62
+ #
63
+ # ##
36
64
 
37
65
  module Configurable
38
66
 
39
- def self.with(*attrs)
40
- not_provided = Object.new
67
+ def self.with(*attrs, **options)
68
+ _not_provided = Object.new
69
+ _app_main = options.empty? || options.values.any?{|v| v == true}
41
70
 
42
- # Define the class/module methods
71
+ # Define the config class/module methods
43
72
  config_class = Class.new do
73
+ # add hash notation
74
+ define_method :[] do |attr|
75
+ instance_variable_get("@#{attr}")
76
+ end
77
+ define_method :[]= do |attr, val|
78
+ instance_variable_set("@#{attr}", val)
79
+ end
80
+
44
81
  attrs.each do |attr|
45
- define_method attr do |value = not_provided, &block|
46
- if value === not_provided && block.nil?
82
+ define_method attr do |value = _not_provided, &block|
83
+ if value === _not_provided && block.nil?
47
84
  result = instance_variable_get("@#{attr}")
48
85
  result.is_a?(Proc) ? instance_eval(&result) : result
49
86
  else
@@ -53,17 +90,38 @@ module SknUtils
53
90
  end
54
91
 
55
92
  attr_writer *attrs
56
- end
93
+ end
57
94
 
58
95
  # Define the runtime access methods
59
96
  class_methods = Module.new do
60
97
  define_method :config do
61
- @config ||= config_class.new
98
+ @__config ||= config_class.new
62
99
  end
63
-
64
100
  def configure(&block)
65
101
  config.instance_eval(&block)
66
102
  end
103
+ if _app_main
104
+ # Enable Rails<Like>.env and Rails.logger like feature:
105
+ # - MyClass.env.production? or MyClass.logger or MyClass.root
106
+ def env
107
+ @__env ||= ::SknUtils::EnvStringHandler.new( ENV.fetch('RACK_ENV', 'development') )
108
+ end
109
+ def env=(str)
110
+ @__env = ::SknUtils::EnvStringHandler.new( str || ENV.fetch('RACK_ENV', 'development') )
111
+ end
112
+ def root
113
+ @__root ||= ::SknUtils::EnvStringHandler.new( Dir.pwd )
114
+ end
115
+ def root=(path)
116
+ @__root = ::SknUtils::EnvStringHandler.new( path || Dir.pwd )
117
+ end
118
+ def logger
119
+ @__logger ||= 'No Logger Assigned.'
120
+ end
121
+ def logger=(obj)
122
+ @__logger = obj
123
+ end
124
+ end
67
125
  end
68
126
 
69
127
  # Apply the custom configuration
@@ -3,10 +3,10 @@
3
3
 
4
4
  module SknUtils
5
5
 
6
- class SknConfiguration < NestedResult
6
+ class Configuration < NestedResult
7
7
 
8
8
  def initialize(params={})
9
- default_mode = defined?(Rails) ? Rails.env : ENV.fetch('RACK_ENV', 'development')
9
+ default_mode = ENV.fetch('RACK_ENV', 'development')
10
10
  @config_filename = params.is_a?(String) ? params : params.fetch(:config_filename, default_mode)
11
11
  @base_path = ENV.fetch('TEST_GEM', 'rails').eql?('gem') ? './spec/factories/' : './config/'
12
12
  load_config_basename!(@config_filename)
@@ -8,7 +8,7 @@ module SknUtils
8
8
 
9
9
  unless Object.respond_to?(:present?)
10
10
 
11
- refine Object do
11
+ class ::Object
12
12
  # An object is blank if it's false, empty, or a whitespace string.
13
13
  # For example, '', ' ', +nil+, [], and {} are all blank.
14
14
  #
@@ -53,7 +53,7 @@ module SknUtils
53
53
  end
54
54
  end
55
55
 
56
- refine NilClass do
56
+ class ::NilClass
57
57
  # +nil+ is blank:
58
58
  #
59
59
  # nil.blank? # => true
@@ -64,7 +64,7 @@ module SknUtils
64
64
  end
65
65
  end
66
66
 
67
- refine FalseClass do
67
+ class ::FalseClass
68
68
  # +false+ is blank:
69
69
  #
70
70
  # false.blank? # => true
@@ -75,7 +75,7 @@ module SknUtils
75
75
  end
76
76
  end
77
77
 
78
- refine TrueClass do
78
+ class ::TrueClass
79
79
  # +true+ is not blank:
80
80
  #
81
81
  # true.blank? # => false
@@ -86,7 +86,7 @@ module SknUtils
86
86
  end
87
87
  end
88
88
 
89
- refine Array do
89
+ class ::Array
90
90
  # An array is blank if it's empty:
91
91
  #
92
92
  # [].blank? # => true
@@ -96,7 +96,7 @@ module SknUtils
96
96
  alias_method :blank?, :empty?
97
97
  end
98
98
 
99
- refine Hash do
99
+ class ::Hash
100
100
  # A hash is blank if it's empty:
101
101
  #
102
102
  # {}.blank? # => true
@@ -106,7 +106,7 @@ module SknUtils
106
106
  alias_method :blank?, :empty?
107
107
  end
108
108
 
109
- refine String do
109
+ class ::String
110
110
  # A string is blank if it's empty or contains whitespaces only:
111
111
  #
112
112
  # ''.blank? # => true
@@ -124,7 +124,7 @@ module SknUtils
124
124
  end
125
125
  end
126
126
 
127
- refine Numeric do #:nodoc:
127
+ class ::Numeric
128
128
  # No number is blank:
129
129
  #
130
130
  # 1.blank? # => false
@@ -135,6 +135,7 @@ module SknUtils
135
135
  false
136
136
  end
137
137
  end
138
+
138
139
  end # end unless respond_to
139
140
 
140
141
  end # end CoreObjectExtensions
@@ -3,7 +3,7 @@ module SknUtils
3
3
  class Version
4
4
  MAJOR = 5
5
5
  MINOR = 0
6
- PATCH = 0
6
+ PATCH = 1
7
7
 
8
8
  def self.to_s
9
9
  [MAJOR, MINOR, PATCH].join('.')
@@ -1,9 +1,19 @@
1
1
  ##
2
- # spec/lib/skn_utils/exploring/configuration_spec.rb
2
+ # spec/lib/skn_utils/configurable_spec.rb
3
3
  #
4
4
 
5
5
  class MyApp
6
- include SknUtils::Configurable.with(:app_id, :title, :cookie_name)
6
+ include SknUtils::Configurable.with( :app_id, :title, :cookie_name, enable_root: true) # No options hash defaults to true
7
+ # - and accept defaults for #env=, #root=, and #logger=
8
+
9
+ # notice: self.logger=, the self is required when assigning values
10
+ self.logger = Object.new
11
+
12
+ configure do
13
+ app_id 'some app'
14
+ title 'My Title'
15
+ cookie_name 'Chocolate'
16
+ end
7
17
 
8
18
  def null_value
9
19
  @app_id.dup
@@ -11,22 +21,16 @@ class MyApp
11
21
  end
12
22
 
13
23
  module MyMod
14
- include SknUtils::Configurable.with(:app_id, :title, :cookie_name)
24
+ include SknUtils::Configurable.with(:app_id, :title, :cookie_name, enable_root: false)
15
25
 
16
26
  def self.null_value
17
- @@app_id.dup
27
+ @app_id.dup
18
28
  end
19
29
  end
20
30
 
21
- MyApp.configure do
22
- app_id 'some app'
23
- title 'My Title'
24
- cookie_name 'Chocolate'
25
- end
26
-
27
31
  MyMod.configure do
28
- app_id 'some module'
29
- title 'Some Title'
32
+ app_id 'some module'
33
+ title 'Some Title'
30
34
  cookie_name 'Caramel'
31
35
  end
32
36
 
@@ -35,8 +39,20 @@ describe SknUtils::Configurable, "Gem Configuration module." do
35
39
 
36
40
  let(:my_app) { MyApp.new }
37
41
 
42
+ context "Top Level AppClass Extra Operational Features. " do
38
43
 
39
- context "Operational Features. " do
44
+ it "MyApp.env.test? returns expected value. " do
45
+ expect( MyApp.env.test? ).to be true
46
+ end
47
+ it "MyApp.root returns expected value. " do
48
+ expect( MyApp.root.realdirpath.to_s ).to eq( Dir.pwd )
49
+ end
50
+ it "MyApp.logger returns expected value. " do
51
+ expect( MyApp.logger ).to be_instance_of(Object) # eq('No Logger Assigned.')
52
+ end
53
+ end
54
+
55
+ context "Module & Class Operational Features. " do
40
56
 
41
57
  it "my_app#config.title returns expected value. " do
42
58
  expect( MyApp.config.title ).to eq( "My Title" )
@@ -52,6 +68,10 @@ describe SknUtils::Configurable, "Gem Configuration module." do
52
68
  expect( MyMod.config.cookie_name ).to eq( 'Caramel' )
53
69
  end
54
70
 
71
+ it "MyMod#logger raises NoMethodError as expected. " do
72
+ expect{ MyMod.logger }.to raise_error(NoMethodError)
73
+ end
74
+
55
75
  end
56
76
 
57
77
  end
@@ -10,8 +10,7 @@ end
10
10
 
11
11
 
12
12
 
13
- describe SknContainer, "Gem D/I Lite Container module." do
14
-
13
+ describe SknContainer, "IoC Lite Container module." do
15
14
 
16
15
  context "Operational Features. " do
17
16
 
@@ -56,6 +55,14 @@ describe SknContainer, "Gem D/I Lite Container module." do
56
55
  subject.register(:service_a, "AnyValue")
57
56
  expect{subject.resolve(:no_find)}.to raise_error ArgumentError
58
57
  end
58
+
59
+ it "#resolve returns block without calling it first. " do
60
+ subject.register(:service_b, {call: false}) do |str|
61
+ str.upcase
62
+ end
63
+
64
+ expect( subject.resolve(:service_b).call("Hello") ).to eq "HELLO"
65
+ end
59
66
  end
60
67
 
61
68
  end
@@ -0,0 +1,67 @@
1
+
2
+ describe SknFailure, "Result/Response Value Container" do
3
+
4
+ let(:default_instance) { described_class.call }
5
+
6
+ context "Created without Params" do
7
+
8
+ it "Exists. " do
9
+ expect(default_instance).to be
10
+ end
11
+
12
+ it "Has default value. " do
13
+ expect(default_instance.value ).to eq "Failure"
14
+ end
15
+
16
+ it "Has default status. " do
17
+ expect(default_instance.success ).to be false
18
+ end
19
+
20
+ it "Has no default message. " do
21
+ expect(default_instance.message ).to be_empty
22
+ end
23
+ end
24
+
25
+ context "Created with Params" do
26
+ it "#success defaults to false. " do
27
+ expect(described_class.call("Testing").success ).to be false
28
+ end
29
+
30
+ it "#success accepts input. " do
31
+ expect(described_class.call("Testing", false).success ).to be false
32
+ end
33
+
34
+ it "#value defaults to Failure. " do
35
+ expect(described_class.call(nil, false ).value ).to eq "Failure"
36
+ end
37
+
38
+ it "#value accepts input. " do
39
+ expect(described_class.call("Don't know why!").value ).to eq "Don't know why!"
40
+ end
41
+
42
+ it "#message accepts input. " do
43
+ expect(described_class.call("Don't know why!", false, 'Something Bad Happened!').message ).to eq "Something Bad Happened!"
44
+ end
45
+ end
46
+
47
+ context "Supports #(), #call, #new, initialization and Forgives. " do
48
+
49
+ it "#(...) is supported. " do
50
+ expect(described_class.('payload', false, "Testing").message ).to eq('Testing')
51
+ end
52
+
53
+ it "#call(...) is supported. " do
54
+ expect(described_class.call('payload', false, "Testing").value ).to eq('payload')
55
+ end
56
+
57
+ it "#new(...) is supported. " do
58
+ expect(described_class.new('payload', false, "Testing").success ).to be false
59
+ end
60
+
61
+ it "Forgives absence of return code input with message. " do
62
+ expect(described_class.('Failure is ... !', 'Forgiveness is Wonderful!').message ).to eq('Forgiveness is Wonderful!')
63
+ expect(described_class.('Failure is ... !', 'Forgiveness is Wonderful!').success ).to be false
64
+ end
65
+ end
66
+ end
67
+
@@ -0,0 +1,68 @@
1
+
2
+ describe SknSuccess, "Result/Response Value Container" do
3
+
4
+ let(:default_instance) { described_class.call }
5
+
6
+ context "Created without Params" do
7
+
8
+ it "Exists. " do
9
+ expect(default_instance).to be
10
+ end
11
+
12
+ it "Has default value " do
13
+ expect(default_instance.value ).to eq "Success"
14
+ end
15
+
16
+ it "Has default status " do
17
+ expect(default_instance.success ).to be true
18
+ end
19
+
20
+ it "Has no default message. " do
21
+ expect(default_instance.message ).to be_empty
22
+ end
23
+ end
24
+
25
+ context "Created with Params" do
26
+ it "#success defaults to true. " do
27
+ expect(described_class.call("Testing").success ).to be true
28
+ end
29
+
30
+ it "#success accepts input. " do
31
+ expect(described_class.call("Testing", true).success ).to be true
32
+ end
33
+
34
+ it "#value defaults to Success. " do
35
+ expect(described_class.call(nil, true).value ).to eq "Success"
36
+ end
37
+
38
+ it "#value accepts input. " do
39
+ expect(described_class.call({some: :hash}).value ).to be_a Hash
40
+ expect(described_class.call("Success is Wonderful!").value ).to eq "Success is Wonderful!"
41
+ end
42
+
43
+ it "#message accepts input. " do
44
+ expect(described_class.call("Success is Wonderful!", true, 'Something Good Happened!').message ).to eq "Something Good Happened!"
45
+ end
46
+ end
47
+
48
+ context "Supports #(), #call, #new, initialization and Forgives. " do
49
+
50
+ it "#(...) is supported. " do
51
+ expect(described_class.('payload', false, "Testing").message ).to eq('Testing')
52
+ end
53
+
54
+ it "#call(...) is supported. " do
55
+ expect(described_class.call('payload', false, "Testing").value ).to eq('payload')
56
+ end
57
+
58
+ it "#new(...) is supported. " do
59
+ expect(described_class.new('payload', false, "Testing").success ).to be true
60
+ end
61
+
62
+ it "Forgives absence of return code input with message. " do
63
+ expect(described_class.('Success is ... !', 'Forgiveness is Wonderful!').message ).to eq('Forgiveness is Wonderful!')
64
+ expect(described_class.('Success is ... !', 'Forgiveness is Wonderful!').success ).to be true
65
+ end
66
+ end
67
+ end
68
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skn_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Scott Jr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-02 00:00:00.000000000 Z
11
+ date: 2018-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge
@@ -165,10 +165,13 @@ files:
165
165
  - bin/console
166
166
  - bin/install
167
167
  - lib/skn_container.rb
168
+ - lib/skn_failure.rb
168
169
  - lib/skn_hash.rb
169
170
  - lib/skn_settings.rb
171
+ - lib/skn_success.rb
170
172
  - lib/skn_utils.rb
171
173
  - lib/skn_utils/configurable.rb
174
+ - lib/skn_utils/configuration.rb
172
175
  - lib/skn_utils/core_extensions.rb
173
176
  - lib/skn_utils/env_string_handler.rb
174
177
  - lib/skn_utils/nested_result.rb
@@ -176,7 +179,6 @@ files:
176
179
  - lib/skn_utils/null_object.rb
177
180
  - lib/skn_utils/page_controls.rb
178
181
  - lib/skn_utils/result_bean.rb
179
- - lib/skn_utils/skn_configuration.rb
180
182
  - lib/skn_utils/version.rb
181
183
  - skn_utils.gemspec
182
184
  - spec/factories/settings.yml
@@ -185,9 +187,11 @@ files:
185
187
  - spec/lib/skn_settings_spec.rb
186
188
  - spec/lib/skn_utils/configurable_spec.rb
187
189
  - spec/lib/skn_utils/container_spec.rb
190
+ - spec/lib/skn_utils/failure_spec.rb
188
191
  - spec/lib/skn_utils/nested_result_spec.rb
189
192
  - spec/lib/skn_utils/notifier_base_spec.rb
190
193
  - spec/lib/skn_utils/null_object_spec.rb
194
+ - spec/lib/skn_utils/success_spec.rb
191
195
  - spec/spec_helper.rb
192
196
  homepage: https://github.com/skoona/skn_utils
193
197
  licenses:
@@ -224,7 +228,9 @@ test_files:
224
228
  - spec/lib/skn_settings_spec.rb
225
229
  - spec/lib/skn_utils/configurable_spec.rb
226
230
  - spec/lib/skn_utils/container_spec.rb
231
+ - spec/lib/skn_utils/failure_spec.rb
227
232
  - spec/lib/skn_utils/nested_result_spec.rb
228
233
  - spec/lib/skn_utils/notifier_base_spec.rb
229
234
  - spec/lib/skn_utils/null_object_spec.rb
235
+ - spec/lib/skn_utils/success_spec.rb
230
236
  - spec/spec_helper.rb