Module: Amrita2::ModelData

Included in:
Amrita2, Expander
Defined in:
lib/amrita2/core.rb

Overview

:nodoc:

Defined Under Namespace

Classes: AttrArray, MultiValue, Tuple

Instance Method Summary collapse

Instance Method Details

#a(hash = {}, &block) ⇒ Object



1342
1343
1344
# File 'lib/amrita2/core.rb', line 1342

def a(hash={}, &block)
  AttrArray.new(hash, &block)
end

#e(tag, hash = {}) ⇒ Object



1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
# File 'lib/amrita2/core.rb', line 1326

def e(tag, hash={})
  ret = REXML::Element.new(tag.to_s)
  hash.each do |k, v|
    ret.attributes[k.to_s] = v
  end
  if block_given?
    case child = yield 
    when REXML::Element
      ret.add child
    else
      ret.text = child
    end
  end
  ret
end

#t(*args) ⇒ Object



1346
1347
1348
# File 'lib/amrita2/core.rb', line 1346

def t(*args)
  Tuple[*args]
end