Class: DeltacloudVM::Client::Helpers::Property::Range
- Defined in:
- lib/deltacloud_vm/client/helpers/property_helper.rb
Instance Attribute Summary collapse
-
#first ⇒ Object
readonly
Returns the value of attribute first.
-
#last ⇒ Object
readonly
Returns the value of attribute last.
Attributes inherited from Property
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, unit, first, last, default = nil) ⇒ Range
constructor
A new instance of Range.
- #value ⇒ Object
Methods inherited from Property
Constructor Details
#initialize(name, unit, first, last, default = nil) ⇒ Range
Returns a new instance of Range.
47 48 49 50 |
# File 'lib/deltacloud_vm/client/helpers/property_helper.rb', line 47 def initialize(name, unit, first, last, default=nil) @first, @last = first, last super(name, unit, default) end |
Instance Attribute Details
#first ⇒ Object (readonly)
Returns the value of attribute first.
45 46 47 |
# File 'lib/deltacloud_vm/client/helpers/property_helper.rb', line 45 def first @first end |
#last ⇒ Object (readonly)
Returns the value of attribute last.
45 46 47 |
# File 'lib/deltacloud_vm/client/helpers/property_helper.rb', line 45 def last @last end |
Class Method Details
.parse(body) ⇒ Object
56 57 58 59 |
# File 'lib/deltacloud_vm/client/helpers/property_helper.rb', line 56 def self.parse(body) base = super new(base.name, base.unit, body.at('range')['first'], body.at('range')['last'], base.default) end |
Instance Method Details
#value ⇒ Object
52 53 54 |
# File 'lib/deltacloud_vm/client/helpers/property_helper.rb', line 52 def value ::Range.new(@first.to_i, @last.to_i) end |