Class: Ruflet::Event
- Inherits:
-
Object
- Object
- Ruflet::Event
- Defined in:
- lib/ruflet_ui/ruflet/event.rb
Instance Attribute Summary collapse
-
#control ⇒ Object
readonly
Returns the value of attribute control.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#typed_data ⇒ Object
readonly
Returns the value of attribute typed_data.
Instance Method Summary collapse
-
#initialize(name:, target:, raw_data:, page:, control:) ⇒ Event
constructor
A new instance of Event.
- #method_missing(name, *args, &block) ⇒ Object
- #respond_to_missing?(name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(name:, target:, raw_data:, page:, control:) ⇒ Event
Returns a new instance of Event.
10 11 12 13 14 15 16 17 18 |
# File 'lib/ruflet_ui/ruflet/event.rb', line 10 def initialize(name:, target:, raw_data:, page:, control:) @name = name @target = target @raw_data = raw_data @data = parse_data(raw_data) @typed_data = Events::GestureEventFactory.build(name, @data) @page = page @control = control end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
32 33 34 35 36 |
# File 'lib/ruflet_ui/ruflet/event.rb', line 32 def method_missing(name, *args, &block) return typed_data.public_send(name, *args, &block) if typed_data && typed_data.respond_to?(name) super end |
Instance Attribute Details
#control ⇒ Object (readonly)
Returns the value of attribute control.
8 9 10 |
# File 'lib/ruflet_ui/ruflet/event.rb', line 8 def control @control end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
8 9 10 |
# File 'lib/ruflet_ui/ruflet/event.rb', line 8 def data @data end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/ruflet_ui/ruflet/event.rb', line 8 def name @name end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
8 9 10 |
# File 'lib/ruflet_ui/ruflet/event.rb', line 8 def page @page end |
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
8 9 10 |
# File 'lib/ruflet_ui/ruflet/event.rb', line 8 def raw_data @raw_data end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
8 9 10 |
# File 'lib/ruflet_ui/ruflet/event.rb', line 8 def target @target end |
#typed_data ⇒ Object (readonly)
Returns the value of attribute typed_data.
8 9 10 |
# File 'lib/ruflet_ui/ruflet/event.rb', line 8 def typed_data @typed_data end |
Instance Method Details
#respond_to_missing?(name, include_private = false) ⇒ Boolean
38 39 40 |
# File 'lib/ruflet_ui/ruflet/event.rb', line 38 def respond_to_missing?(name, include_private = false) (typed_data && typed_data.respond_to?(name, include_private)) || super end |