Module: Roy::Source
- Defined in:
- lib/source.rb,
lib/roy_lang.rb
Class Method Summary collapse
- .bare_option ⇒ Object
- .bundled_path ⇒ Object
- .contents ⇒ Object
- .context ⇒ Object
- .path ⇒ Object
- .path=(path) ⇒ Object
- .version ⇒ Object
Class Method Details
.bare_option ⇒ Object
26 27 28 |
# File 'lib/roy_lang.rb', line 26 def self. @bare_option ||= contents.match(/noWrap/) ? 'noWrap' : 'bare' end |
.bundled_path ⇒ Object
3 4 5 |
# File 'lib/source.rb', line 3 def self.bundled_path File.("../bundled-roy.js", __FILE__) end |
.contents ⇒ Object
18 19 20 |
# File 'lib/roy_lang.rb', line 18 def self.contents @contents ||= File.read(path) end |
.context ⇒ Object
30 31 32 |
# File 'lib/roy_lang.rb', line 30 def self.context @context ||= ExecJS.compile(contents) end |
.path ⇒ Object
9 10 11 |
# File 'lib/roy_lang.rb', line 9 def self.path @path ||= ENV['ROY_SOURCE_PATH'] || bundled_path end |
.path=(path) ⇒ Object
13 14 15 16 |
# File 'lib/roy_lang.rb', line 13 def self.path=(path) @contents = @version = @context = nil @path = path end |
.version ⇒ Object
22 23 24 |
# File 'lib/roy_lang.rb', line 22 def self.version @version ||= contents[/Roy v([\d.]+)/, 1] end |