Class: Scarpe::ShoesSpecProxy
- Inherits:
- 
      Object
      
        - Object
- Scarpe::ShoesSpecProxy
 
- Defined in:
- lib/scarpe/shoes_spec.rb
Constant Summary collapse
- JS_EVENTS =
- [:click, :hover, :leave, :change] 
Instance Attribute Summary collapse
- 
  
    
      #display  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute display. 
- 
  
    
      #linkable_id  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute linkable_id. 
- 
  
    
      #obj  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute obj. 
Instance Method Summary collapse
- 
  
    
      #initialize(obj)  ⇒ ShoesSpecProxy 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of ShoesSpecProxy. 
- #method_missing(method) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
- #trigger(event_name, *args) ⇒ Object
Constructor Details
#initialize(obj) ⇒ ShoesSpecProxy
Returns a new instance of ShoesSpecProxy.
| 64 65 66 67 68 69 70 71 72 | # File 'lib/scarpe/shoes_spec.rb', line 64 def initialize(obj) @obj = obj @linkable_id = obj.linkable_id @display = ::Shoes::DisplayService.display_service.query_display_drawable_for(obj.linkable_id) unless @display raise "Can't find display widget for #{obj.inspect}!" end end | 
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
| 74 75 76 77 78 79 80 81 82 83 | # File 'lib/scarpe/shoes_spec.rb', line 74 def method_missing(method, ...) if @obj.respond_to?(method) self.singleton_class.define_method(method) do |*args, **kwargs, &block| @obj.send(method, *args, **kwargs, &block) end send(method, ...) else super # raise an exception end end | 
Instance Attribute Details
#display ⇒ Object (readonly)
Returns the value of attribute display.
| 60 61 62 | # File 'lib/scarpe/shoes_spec.rb', line 60 def display @display end | 
#linkable_id ⇒ Object (readonly)
Returns the value of attribute linkable_id.
| 59 60 61 | # File 'lib/scarpe/shoes_spec.rb', line 59 def linkable_id @linkable_id end | 
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
| 58 59 60 | # File 'lib/scarpe/shoes_spec.rb', line 58 def obj @obj end | 
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
| 96 97 98 | # File 'lib/scarpe/shoes_spec.rb', line 96 def respond_to_missing?(method_name, include_private = false) @obj.respond_to_missing?(method_name, include_private) end | 
#trigger(event_name, *args) ⇒ Object
| 85 86 87 88 | # File 'lib/scarpe/shoes_spec.rb', line 85 def trigger(event_name, *args) name = "#{@linkable_id}-#{event_name}" Scarpe::Webview::DisplayService.instance.app.handle_callback(name, *args) end |