Class: Nodeify::JavaScript

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/nodeify/java_script.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bodyObject

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, options)
  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

#prepareObject



12
13
# File 'lib/nodeify/java_script.rb', line 12

def prepare
end