class CheckMot::Resource
Attributes
source_hash[R]
Public Class Methods
new(source_hash)
click to toggle source
# File lib/check_mot/resource.rb, line 4 def initialize(source_hash) @source_hash = source_hash end
Public Instance Methods
inspect()
click to toggle source
# File lib/check_mot/resource.rb, line 17 def inspect # prevents extraneous output in the console: to_s end
method_missing(name, *args)
click to toggle source
Calls superclass method
# File lib/check_mot/resource.rb, line 12 def method_missing(name, *args) super unless source_hash.keys.include?(name) resolved_attribute(name) end
respond_to_missing?(name, include_private = false)
click to toggle source
Calls superclass method
# File lib/check_mot/resource.rb, line 8 def respond_to_missing?(name, include_private = false) super || source_hash.keys.include?(name) end
Private Instance Methods
resolve_attribute(name, value)
click to toggle source
# File lib/check_mot/resource.rb, line 34 def resolve_attribute(name, value) attr = Attribute.resolve(name, value) case attr when Array attr.map { |value| resolve_attribute(name, value) } when Hash Resource.new(attr) when Attribute attr.value else value end end
resolved_attribute(name)
click to toggle source
# File lib/check_mot/resource.rb, line 26 def resolved_attribute(name) resolved_attributes[name] ||= resolve_attribute(name, @source_hash[name]) end
resolved_attributes()
click to toggle source
# File lib/check_mot/resource.rb, line 30 def resolved_attributes @_resolved_attributes ||= {} end