Method: Celerity::Element#method_missing

Defined in:
lib/celerity/element.rb

#method_missing(meth, *args, &blk) ⇒ String

Dynamically get element attributes.

Returns:

  • (String)

    The resulting attribute.

Raises:

  • (NoMethodError)

    if the element doesn’t support this attribute.

See Also:



267
268
269
270
271
272
273
274
275
276
277
# File 'lib/celerity/element.rb', line 267

def method_missing(meth, *args, &blk)
  assert_exists

  meth = selector_to_attribute(meth)

  if self.class::ATTRIBUTES.include?(meth) || (self.class == Element && @object.hasAttribute(meth.to_s))
    return @object.getAttribute(meth.to_s)
  end
  Log.warn "Element\#method_missing calling super with #{meth.inspect}"
  super
end