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
14 15 16 |
# File 'lib/sibilant.rb', line 14 def package_json JSON.parse package_json_file.read end |
#package_json_file ⇒ Object
10 11 12 |
# File 'lib/sibilant.rb', line 10 def package_json_file File.open File.join(sibilant_js_root, 'package.json') end |
#sibilant_cli ⇒ Object
22 23 24 |
# File 'lib/sibilant.rb', line 22 def sibilant_cli File.join sibilant_js_root, 'bin', 'sibilant' end |
#sibilant_js_root ⇒ Object
6 7 8 |
# File 'lib/sibilant.rb', line 6 def sibilant_js_root File.join File.dirname(__FILE__), '..', 'js', 'sibilant' end |
#translate(sibilant_code) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/sibilant.rb', line 26 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
18 19 20 |
# File 'lib/sibilant.rb', line 18 def version package_json[:version] end |