Class: Koch::Resource
- Inherits:
-
Object
- Object
- Koch::Resource
- Defined in:
- lib/koch/resource.rb
Overview
Resource represents a thing in the system that can be changed by Koch
Direct Known Subclasses
AbstractPackage, AbstractSnapPackage, CreateDirectory, CreateFile, DeleteDirectory, DeleteFile, Group, Run, Swapfile, SystemdService, SystemdTimerService, User
Instance Attribute Summary collapse
-
#changed ⇒ Object
readonly
Returns the value of attribute changed.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
#initialize(name) ⇒ Resource
Returns a new instance of Resource.
8 9 10 |
# File 'lib/koch/resource.rb', line 8 def initialize(name) @name = name end |
Instance Attribute Details
#changed ⇒ Object (readonly)
Returns the value of attribute changed.
6 7 8 |
# File 'lib/koch/resource.rb', line 6 def changed @changed end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/koch/resource.rb', line 6 def name @name end |
Class Method Details
.dsl_writer(*syms) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/koch/resource.rb', line 12 def self.dsl_writer(*syms) syms.each do |sym| define_method sym do |*args| if args.empty? instance_variable_get "@#{sym}" elsif args.size == 1 instance_variable_set "@#{sym}", args[0] else instance_variable_set "@#{sym}", args end end end end |