Module: ChefSpec::Normalize

Included in:
Matchers::NotificationsMatcher, Renderer, Runner
Defined in:
lib/chefspec/mixins/normalize.rb

Instance Method Summary collapse

Instance Method Details

#resource_name(thing) ⇒ Symbol

Calculate the name of a resource, replacing dashes with underscores and converting symbols to strings and back again.

Parameters:

Returns:

  • (Symbol)


11
12
13
14
# File 'lib/chefspec/mixins/normalize.rb', line 11

def resource_name(thing)
  name = thing.respond_to?(:resource_name) ? thing.resource_name : thing
  name.to_s.gsub('-', '_').to_sym
end