Class: Ruflet::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/ruflet_ui/ruflet/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#controlObject (readonly)

Returns the value of attribute control.



8
9
10
# File 'lib/ruflet_ui/ruflet/event.rb', line 8

def control
  @control
end

#dataObject (readonly)

Returns the value of attribute data.



8
9
10
# File 'lib/ruflet_ui/ruflet/event.rb', line 8

def data
  @data
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/ruflet_ui/ruflet/event.rb', line 8

def name
  @name
end

#pageObject (readonly)

Returns the value of attribute page.



8
9
10
# File 'lib/ruflet_ui/ruflet/event.rb', line 8

def page
  @page
end

#raw_dataObject (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

#targetObject (readonly)

Returns the value of attribute target.



8
9
10
# File 'lib/ruflet_ui/ruflet/event.rb', line 8

def target
  @target
end

#typed_dataObject (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

Returns:

  • (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