Class: DocumentingLWRPBase

Inherits:
Chef::Resource::LWRPBase
  • Object
show all
Defined in:
lib/knife_cookbook_doc/documenting_lwrp_base.rb

Constant Summary collapse

NOT_PASSED =
defined?(::Chef::NOT_PASSED) ? ::Chef::NOT_PASSED : "NOT_PASSED"

Class Method Summary collapse

Class Method Details

.attribute(attr_name, validation_opts = {}) ⇒ Object



25
26
27
28
29
# File 'lib/knife_cookbook_doc/documenting_lwrp_base.rb', line 25

def self.attribute(attr_name, validation_opts={})
  result = super(attr_name, validation_opts)
  attribute_specifications[attr_name] = validation_opts
  result
end

.attribute_specificationsObject



6
7
8
# File 'lib/knife_cookbook_doc/documenting_lwrp_base.rb', line 6

def attribute_specifications
  @attribute_specifications ||= {}
end

.desc(description) ⇒ Object



10
11
12
# File 'lib/knife_cookbook_doc/documenting_lwrp_base.rb', line 10

def desc(description)
  @description = "#{@description}#{description}\n"
end

.descriptionObject



14
15
16
# File 'lib/knife_cookbook_doc/documenting_lwrp_base.rb', line 14

def description
  @description || ""
end

.property(name, type = NOT_PASSED, **options) ⇒ Object



19
20
21
22
# File 'lib/knife_cookbook_doc/documenting_lwrp_base.rb', line 19

def property(name, type = NOT_PASSED, **options)
  attribute_specifications[name] = options
  super(name, type, **options) if defined?(super)
end