Class: RiotJs::Rails::SprocketsExtensionBase
- Inherits:
- 
      Object
      
        - Object
- RiotJs::Rails::SprocketsExtensionBase
 
- Defined in:
- lib/riot_js/rails/processors/processor.rb
Overview
Sprockets 2, 3 & 4 interface
Direct Known Subclasses
Instance Attribute Summary collapse
- 
  
    
      #default_mime_type  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute default_mime_type. 
Class Method Summary collapse
Instance Method Summary collapse
- 
  
    
      #initialize(filename, &block)  ⇒ SprocketsExtensionBase 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of SprocketsExtensionBase. 
- #render(context, empty_hash_wtf) ⇒ Object
Constructor Details
#initialize(filename, &block) ⇒ SprocketsExtensionBase
Returns a new instance of SprocketsExtensionBase.
| 10 11 12 13 | # File 'lib/riot_js/rails/processors/processor.rb', line 10 def initialize(filename, &block) @filename = filename @source = block.call end | 
Instance Attribute Details
#default_mime_type ⇒ Object (readonly)
Returns the value of attribute default_mime_type.
| 8 9 10 | # File 'lib/riot_js/rails/processors/processor.rb', line 8 def default_mime_type @default_mime_type end | 
Class Method Details
.call(input) ⇒ Object
| 23 24 25 26 27 28 29 30 31 32 33 34 | # File 'lib/riot_js/rails/processors/processor.rb', line 23 def self.call(input) if input.is_a?(String) run("", input, nil) else filename = input[:filename] source = input[:data] context = input[:environment].context_class.new(input) result = run(filename, source, context) context..merge(data: result) end end | 
.run(filename, source, context) ⇒ Object
| 19 20 21 | # File 'lib/riot_js/rails/processors/processor.rb', line 19 def self.run(filename, source, context) raise 'Not implemented' end | 
Instance Method Details
#render(context, empty_hash_wtf) ⇒ Object
| 15 16 17 | # File 'lib/riot_js/rails/processors/processor.rb', line 15 def render(context, empty_hash_wtf) self.class.run(@filename, @source, context) end |