Class: Rig::Template::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rig/template.rb

Direct Known Subclasses

Server

Instance Method Summary collapse

Instance Method Details

#attr(name, value = nil) ⇒ Object



68
69
70
71
# File 'lib/rig/template.rb', line 68

def attr(name, value=nil)
  @attrs[name] = value unless value.nil?
  @attrs[name]
end

#list_attr(name, value = nil) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/rig/template.rb', line 73

def list_attr(name, value=nil)
  @attrs[name] ||= []
  unless value.nil?
    if value.kind_of?(Array)
      @attrs[name] += value
    else
      @attrs[name] << value
    end
  end
  @attrs[name]
end