Class: ConfigOMat::LoadedFacterProfile
- Inherits:
-
ConfigItem
- Object
- ConfigItem
- ConfigOMat::LoadedFacterProfile
- Defined in:
- lib/config_o_mat/shared/types.rb
Constant Summary collapse
- CLEAR_FROM_FACTER =
[ "memoryfree", "memoryfree_mb", "load_averages", "uptime", "system_uptime", "uptime_seconds", "uptime_hours", "uptime_days", {"ec2_metadata" => ["identity-credentials", "iam"]}, {"memory" => [{"system" => ["capacity", "available_bytes", "used", "used_bytes", "available"] }] } ].freeze
Instance Attribute Summary collapse
-
#contents ⇒ Object
readonly
Returns the value of attribute contents.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Attributes inherited from ConfigItem
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #fallback? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name) ⇒ LoadedFacterProfile
constructor
A new instance of LoadedFacterProfile.
- #to_h ⇒ Object
- #validate ⇒ Object
Methods inherited from ConfigItem
#==, #error, #errors?, #validate!
Constructor Details
#initialize(name) ⇒ LoadedFacterProfile
Returns a new instance of LoadedFacterProfile.
219 220 221 222 223 |
# File 'lib/config_o_mat/shared/types.rb', line 219 def initialize(name) @name = name load_from_facter @version = contents.hash end |
Instance Attribute Details
#contents ⇒ Object (readonly)
Returns the value of attribute contents.
217 218 219 |
# File 'lib/config_o_mat/shared/types.rb', line 217 def contents @contents end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
217 218 219 |
# File 'lib/config_o_mat/shared/types.rb', line 217 def name @name end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
217 218 219 |
# File 'lib/config_o_mat/shared/types.rb', line 217 def version @version end |
Instance Method Details
#eql?(other) ⇒ Boolean
243 244 245 246 247 |
# File 'lib/config_o_mat/shared/types.rb', line 243 def eql?(other) return false if !super(other) return false if other.version != version || other.name != name true end |
#fallback? ⇒ Boolean
225 226 227 |
# File 'lib/config_o_mat/shared/types.rb', line 225 def fallback? false end |
#hash ⇒ Object
235 236 237 |
# File 'lib/config_o_mat/shared/types.rb', line 235 def hash @name.hash ^ @version end |
#to_h ⇒ Object
239 240 241 |
# File 'lib/config_o_mat/shared/types.rb', line 239 def to_h @contents end |
#validate ⇒ Object
229 230 231 232 233 |
# File 'lib/config_o_mat/shared/types.rb', line 229 def validate error :name, PRESENCE_ERROR_MSG if @name.nil? || @name.empty? error :contents, PRESENCE_ERROR_MSG if @contents.nil? || @contents.empty? error :contents, 'must be a hash' if !@contents.kind_of?(Hash) end |