Class: PackageGenerator::InstallItem
- Inherits:
-
Object
- Object
- PackageGenerator::InstallItem
- Defined in:
- lib/packagegenerator/install_item.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#group ⇒ Object
writeonly
Sets the attribute group.
-
#mode ⇒ Object
writeonly
Sets the attribute mode.
-
#source ⇒ Object
writeonly
Sets the attribute source.
-
#target ⇒ Object
writeonly
Sets the attribute target.
-
#user ⇒ Object
writeonly
Sets the attribute user.
Instance Method Summary collapse
-
#initialize(args) ⇒ InstallItem
constructor
A new instance of InstallItem.
- #validate ⇒ Object
Constructor Details
#initialize(args) ⇒ InstallItem
Returns a new instance of InstallItem.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/packagegenerator/install_item.rb', line 5 def initialize args unless args.nil? @mode = args[:mode] if args.has_key?(:mode) @group = args[:group] if args.has_key?(:group) @user = args[:user] if args.has_key?(:user) @source = args[:source] if args.has_key?(:source) @target = args[:target] if args.has_key?(:target) else @mode = 644 @user = 'root' @group ='root' end end |
Instance Attribute Details
#group=(value) ⇒ Object (writeonly)
Sets the attribute group
3 4 5 |
# File 'lib/packagegenerator/install_item.rb', line 3 def group=(value) @group = value end |
#mode=(value) ⇒ Object (writeonly)
Sets the attribute mode
3 4 5 |
# File 'lib/packagegenerator/install_item.rb', line 3 def mode=(value) @mode = value end |
#source=(value) ⇒ Object (writeonly)
Sets the attribute source
3 4 5 |
# File 'lib/packagegenerator/install_item.rb', line 3 def source=(value) @source = value end |
#target=(value) ⇒ Object (writeonly)
Sets the attribute target
3 4 5 |
# File 'lib/packagegenerator/install_item.rb', line 3 def target=(value) @target = value end |
#user=(value) ⇒ Object (writeonly)
Sets the attribute user
3 4 5 |
# File 'lib/packagegenerator/install_item.rb', line 3 def user=(value) @user = value end |
Instance Method Details
#validate ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/packagegenerator/install_item.rb', line 20 def validate raise ArgumentError, 'mode must be an number.' unless @mode.is_a?(Numeric) raise ArgumentError, 'user cannot be nil.' if @user.nil? raise ArgumentError, 'group cannot be nil.' if @group.nil? raise ArgumentError, 'source cannot be nil.' if @source.nil? unless self.is_a?(InstallDirectory) raise ArgumentError, 'target cannot be nil.' if @target.nil? end |