Class: Koch::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/koch/resource.rb

Overview

Resource represents a thing in the system that can be changed by Koch

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#changedObject (readonly)

Returns the value of attribute changed.



6
7
8
# File 'lib/koch/resource.rb', line 6

def changed
  @changed
end

#nameObject (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