Class: Buttons::Javascript::JsGenerator
- Inherits:
-
Object
- Object
- Buttons::Javascript::JsGenerator
- Defined in:
- lib/buttons/javascript/js_generator.rb
Instance Method Summary collapse
-
#initialize(button) ⇒ JsGenerator
constructor
A new instance of JsGenerator.
- #to_js ⇒ Object
Constructor Details
#initialize(button) ⇒ JsGenerator
Returns a new instance of JsGenerator.
6 7 8 9 |
# File 'lib/buttons/javascript/js_generator.rb', line 6 def initialize() @button = # @compressor = YUI::JavaScriptCompressor.new end |
Instance Method Details
#to_js ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/buttons/javascript/js_generator.rb', line 11 def to_js js = %Q[ (function () { this.#{@button.namespace.capitalize} = {}; #{@button.js_functions.map { |function| function.to_js(@button.namespace.capitalize) }.join("\n")} })(); ] # @compressor.compress(js) js.strip_whitespace end |