class Rundock::Attribute::Base

Public Class Methods

attr_accessor(*vars) click to toggle source
Calls superclass method
# File lib/rundock/attribute/base.rb, line 8
def self.attr_accessor(*vars)
  @attributes ||= []
  @attributes.concat(vars)
  super(*vars)
end
list() click to toggle source
# File lib/rundock/attribute/base.rb, line 14
def self.list
  @attributes
end
new(attr = {}) click to toggle source
# File lib/rundock/attribute/base.rb, line 4
def initialize(attr = {})
  attr.each { |k, v| define_attr(k.to_sym, v) }
end

Public Instance Methods

define_attr(name, val) click to toggle source
# File lib/rundock/attribute/base.rb, line 24
def define_attr(name, val)
  self.class.send(:attr_accessor, name)
  self.send("#{name}=", val)
end
list() click to toggle source
# File lib/rundock/attribute/base.rb, line 18
def list
  self.class.list.each_with_object({}) do |a, result|
    result[a] = self.send(a)
  end
end