class Motion::Element
Attributes
raw[R]
Public Class Methods
from_raw(raw)
click to toggle source
# File lib/motion/element.rb, line 7 def self.from_raw(raw) new(raw) if raw end
new(raw)
click to toggle source
# File lib/motion/element.rb, line 13 def initialize(raw) @raw = raw.freeze end
Public Instance Methods
[](key)
click to toggle source
# File lib/motion/element.rb, line 29 def [](key) key = key.to_s attributes[key] || attributes[key.tr("_", "-")] end
attributes()
click to toggle source
# File lib/motion/element.rb, line 25 def attributes raw.fetch("attributes", {}) end
data()
click to toggle source
# File lib/motion/element.rb, line 53 def data return @data if defined?(@data) @data = DataAttributes.new(self) end
form_data()
click to toggle source
# File lib/motion/element.rb, line 59 def form_data return @form_data if defined?(@form_data) @form_data = ActionController::Parameters.new( Rack::Utils.parse_nested_query( raw.fetch("formData", "") ) ) end
id()
click to toggle source
# File lib/motion/element.rb, line 35 def id self[:id] end
tag_name()
click to toggle source
# File lib/motion/element.rb, line 17 def tag_name raw["tagName"] end
value()
click to toggle source
# File lib/motion/element.rb, line 21 def value raw["value"] end