Class: BlockDevice
- Inherits:
-
Object
- Object
- BlockDevice
- Defined in:
- lib/ec2launcher/block_device.rb
Overview
Copyright © 2012 Sean Laurent
Instance Attribute Summary collapse
-
#mount_point ⇒ Object
readonly
Returns the value of attribute mount_point.
-
#name(*name) ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #count(*block_count) ⇒ Object
- #group(*group) ⇒ Object
-
#initialize ⇒ BlockDevice
constructor
A new instance of BlockDevice.
- #is_raid? ⇒ Boolean
- #mount(*mount) ⇒ Object
- #owner(*owner) ⇒ Object
- #raid_level(*raid_level) ⇒ Object
- #size(*volume_size) ⇒ Object
- #to_json(*a) ⇒ Object
Constructor Details
#initialize ⇒ BlockDevice
Returns a new instance of BlockDevice.
8 9 10 11 12 |
# File 'lib/ec2launcher/block_device.rb', line 8 def initialize() @count = 1 @group = "root" @user = "root" end |
Instance Attribute Details
#mount_point ⇒ Object (readonly)
Returns the value of attribute mount_point.
5 6 7 |
# File 'lib/ec2launcher/block_device.rb', line 5 def mount_point @mount_point end |
#name(*name) ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/ec2launcher/block_device.rb', line 6 def name @name end |
Instance Method Details
#count(*block_count) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/ec2launcher/block_device.rb', line 18 def count(*block_count) if block_count.empty? @count else @count = block_count[0] self end end |
#group(*group) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/ec2launcher/block_device.rb', line 27 def group(*group) if group.empty? @group else @group = group[0] self end end |
#is_raid? ⇒ Boolean
14 15 16 |
# File 'lib/ec2launcher/block_device.rb', line 14 def is_raid?() @raid_level.nil? end |
#mount(*mount) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/ec2launcher/block_device.rb', line 36 def mount(*mount) if mount.empty? @mount else @mount_point = mount[0] self end end |
#owner(*owner) ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/ec2launcher/block_device.rb', line 54 def owner(*owner) if owner.empty? @owner else @owner = owner[0] self end end |
#raid_level(*raid_level) ⇒ Object
63 64 65 66 67 68 69 70 |
# File 'lib/ec2launcher/block_device.rb', line 63 def raid_level(*raid_level) if raid_level.empty? @raid_level else @raid_level = raid_level[0] self end end |
#size(*volume_size) ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/ec2launcher/block_device.rb', line 72 def size(*volume_size) if volume_size.empty? @size else @size = volume_size[0].to_i self end end |
#to_json(*a) ⇒ Object
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/ec2launcher/block_device.rb', line 81 def to_json(*a) { "name" => @name, "count" => @count, "raid_level" => @raid_level, "mount_point" => @mount_point, "owner" => @owner, "group" => @group }.to_json(*a) end |