Class: Nodeify::JavaScript
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- Nodeify::JavaScript
- Defined in:
- lib/nodeify/java_script.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
Instance Method Summary collapse
- #evaluate(context, options) ⇒ Object
-
#initialize(*arg) ⇒ JavaScript
constructor
A new instance of JavaScript.
- #prepare ⇒ Object
Constructor Details
#initialize(*arg) ⇒ JavaScript
Returns a new instance of JavaScript.
8 9 10 |
# File 'lib/nodeify/java_script.rb', line 8 def initialize(*arg) super end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
6 7 8 |
# File 'lib/nodeify/java_script.rb', line 6 def body @body end |
Instance Method Details
#evaluate(context, options) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/nodeify/java_script.rb', line 15 def evaluate(context, ) output = '' file_path = file + '.tmp' File.open(file_path, 'w') { |f| f.puts data } output = `node -e "var browserify = require('browserify'), _ = process.stdout.write(browserify({ entry: '#{file_path}', require: { http: 'dkastner-http-browserify' } }).bundle());"` FileUtils.rm_f file_path output end |
#prepare ⇒ Object
12 13 |
# File 'lib/nodeify/java_script.rb', line 12 def prepare end |