sparkle_formation 2.0.0 → 2.0.2

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.
@@ -217,18 +217,22 @@ class SparkleFormation
217
217
  if(block_given?)
218
218
  result.instance_exec(&block)
219
219
  end
220
- result = struct
221
220
  rescue Error::NotFound::Dynamic
222
221
  result = builtin_insert(dynamic_name, struct, *args, &block)
223
- end
224
- unless(result)
225
- message = "Failed to locate requested dynamic block for insertion: #{dynamic_name} " \
222
+ unless(result)
223
+ message = "Failed to locate requested dynamic block for insertion: #{dynamic_name} " \
226
224
  "(valid: #{struct._self.sparkle.dynamics.keys.sort.join(', ')})"
227
- if(struct._self.provider_resources && struct._self.provider_resources.registry.keys.size > 1)
228
- t_name = struct._self.provider_resources.registry.keys.first
229
- message << "\nBuiltin dynamics pattern `#{t_name}` -> `:#{Bogo::Utility.snake(t_name.gsub('::', '_'))}`"
225
+ if(struct._self.provider_resources && struct._self.provider_resources.registry.keys.size > 1)
226
+ t_name = struct._self.provider_resources.registry.keys.first
227
+ valid_t_name = Bogo::Utility.snake(
228
+ t_name.split(
229
+ struct._self.provider_resources.resource_type_splitter
230
+ ).join('_')
231
+ )
232
+ message << "\nBuiltin dynamics pattern `#{t_name}` -> `:#{Bogo::Utility.snake(valid_t_name)}`"
233
+ end
234
+ raise message
230
235
  end
231
- raise message
232
236
  end
233
237
  result
234
238
  end
@@ -311,6 +315,7 @@ class SparkleFormation
311
315
  end
312
316
  end
313
317
  new_resource.instance_exec(&block) if block
318
+ struct._self.provider_resources.resource_customizer(new_resource, lookup_key)
314
319
  new_resource
315
320
  end
316
321
  end
@@ -565,6 +570,9 @@ class SparkleFormation
565
570
  const = SparkleAttribute.const_get(camel(provider))
566
571
  struct_class = Class.new(SparkleStruct)
567
572
  struct_class.include(const)
573
+ struct_name = [SparkleStruct.name, camel(provider)].join('::')
574
+ struct_class.define_singleton_method(:name){ struct_name }
575
+ struct_class.define_singleton_method(:to_s){ struct_name }
568
576
  else
569
577
  struct_class = SparkleStruct
570
578
  end
@@ -75,6 +75,9 @@ class SparkleFormation
75
75
  # Override to inspect result value and fetch root if value is a
76
76
  # FunctionStruct
77
77
  def method_missing(sym, *args, &block)
78
+ if(sym.to_s.start_with?('_') || sym.to_s.end_with?('!'))
79
+ ::Kernel.raise ::NoMethodError.new "Undefined method `#{sym}` for #{_klass.name}"
80
+ end
78
81
  result = super(*[sym, *args], &block)
79
82
  @table[_process_key(sym)] = function_bubbler(result)
80
83
  end
@@ -1,5 +1,5 @@
1
1
  # Unicorns and rainbows
2
2
  class SparkleFormation
3
3
  # Current library version
4
- VERSION = Gem::Version.new('2.0.0')
4
+ VERSION = Gem::Version.new('2.0.2')
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sparkle_formation
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-21 00:00:00.000000000 Z
11
+ date: 2016-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attribute_struct