Class: Sibilant::Compiler
- Inherits:
-
Object
- Object
- Sibilant::Compiler
- Defined in:
- lib/sibilant.rb
Instance Method Summary collapse
- #package_json ⇒ Object
- #package_json_file ⇒ Object
- #sibilant_cli ⇒ Object
- #sibilant_js_root ⇒ Object
- #translate(sibilant_code) ⇒ Object
- #version ⇒ Object
Instance Method Details
#package_json ⇒ Object
20 21 22 |
# File 'lib/sibilant.rb', line 20 def package_json JSON.parse package_json_file.read end |
#package_json_file ⇒ Object
16 17 18 |
# File 'lib/sibilant.rb', line 16 def package_json_file File.open File.join(sibilant_js_root, 'package.json') end |
#sibilant_cli ⇒ Object
28 29 30 |
# File 'lib/sibilant.rb', line 28 def sibilant_cli File.join sibilant_js_root, 'bin', 'sibilant' end |
#sibilant_js_root ⇒ Object
12 13 14 |
# File 'lib/sibilant.rb', line 12 def sibilant_js_root File.join File.dirname(__FILE__), '..', 'js', 'sibilant' end |
#translate(sibilant_code) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/sibilant.rb', line 32 def translate(sibilant_code) IO.popen("#{sibilant_cli} -i", 'r+') do |sibilant| sibilant.puts sibilant_code sibilant.close_write sibilant.read end.strip end |
#version ⇒ Object
24 25 26 |
# File 'lib/sibilant.rb', line 24 def version package_json[:version] end |