Class: Collins::Ipmi
Constant Summary
Constants included from Util::Logging
Util::Logging::DEFAULT_LOG_FORMAT
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#asset_id ⇒ Object
Returns the value of attribute asset_id.
-
#gateway ⇒ Object
Returns the value of attribute gateway.
-
#id ⇒ Object
Returns the value of attribute id.
-
#netmask ⇒ Object
Returns the value of attribute netmask.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(opts = {}) ⇒ Ipmi
constructor
A new instance of Ipmi.
- #to_s ⇒ Object
Methods included from Util
#deep_copy_hash, #get_asset_or_tag, included, #require_non_empty, #require_that, #stringify_hash, #symbolize_hash
Methods included from Util::Logging
Constructor Details
#initialize(opts = {}) ⇒ Ipmi
Returns a new instance of Ipmi.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/collins/ipmi.rb', line 13 def initialize opts = {} hash = symbolize_hash(opts).inject({}) do |result, (k,v)| key = k.to_s.downcase.sub(/^ipmi_/, "").to_sym result[key] = v result end @address = hash[:address].to_s @asset_id = hash[:asset_id].to_s.to_i @gateway = hash[:gateway].to_s @id = hash[:id].to_s.to_i @netmask = hash[:netmask].to_s @password = hash[:password].to_s @username = hash[:username].to_s end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
7 8 9 |
# File 'lib/collins/ipmi.rb', line 7 def address @address end |
#asset_id ⇒ Object
Returns the value of attribute asset_id.
7 8 9 |
# File 'lib/collins/ipmi.rb', line 7 def asset_id @asset_id end |
#gateway ⇒ Object
Returns the value of attribute gateway.
7 8 9 |
# File 'lib/collins/ipmi.rb', line 7 def gateway @gateway end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/collins/ipmi.rb', line 7 def id @id end |
#netmask ⇒ Object
Returns the value of attribute netmask.
7 8 9 |
# File 'lib/collins/ipmi.rb', line 7 def netmask @netmask end |
#password ⇒ Object
Returns the value of attribute password.
7 8 9 |
# File 'lib/collins/ipmi.rb', line 7 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
7 8 9 |
# File 'lib/collins/ipmi.rb', line 7 def username @username end |
Class Method Details
Instance Method Details
#empty? ⇒ Boolean
28 29 30 |
# File 'lib/collins/ipmi.rb', line 28 def empty? @id == 0 end |
#to_s ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/collins/ipmi.rb', line 32 def to_s if empty? then "Ipmi(None)" else "Ipmi(id = #{id}, asset_id = #{asset_id}, address = #{address}, gateway = #{gateway}, netmask = #{netmask}, username = #{username}, password = #{password})" end end |