Module: LiveScript
- Defined in:
- lib/livescript.rb,
lib/livescript/version.rb
Constant Summary collapse
- VERSION =
'2.3.0'
Class Method Summary collapse
-
.compile(script, options = {}) ⇒ Object
Compile a script (String or IO) to JavaScript.
- .context ⇒ Object
- .context=(context) ⇒ Object
- .default_options ⇒ Object
- .default_options=(options) ⇒ Object
- .engine ⇒ Object
- .engine=(engine) ⇒ Object
- .version ⇒ Object
Class Method Details
.compile(script, options = {}) ⇒ Object
Compile a script (String or IO) to JavaScript.
31 32 33 34 35 36 37 38 |
# File 'lib/livescript.rb', line 31 def self.compile(script, = {}) # Read content if script is IO object script = script.read if script.respond_to?(:read) = @default_options.merge() @context.call('LiveScript.compile', script, ) end |
.context ⇒ Object
10 11 12 |
# File 'lib/livescript.rb', line 10 def self.context @context end |
.context=(context) ⇒ Object
14 15 16 |
# File 'lib/livescript.rb', line 14 def self.context=(context) @context = context end |
.default_options ⇒ Object
18 19 20 |
# File 'lib/livescript.rb', line 18 def self. @default_options end |
.default_options=(options) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/livescript.rb', line 22 def self.() if .nil? || !.kind_of?(Hash) raise "Wrong parameter for default_options: #{.inspect}" else @default_options = end end |
.engine ⇒ Object
40 41 |
# File 'lib/livescript.rb', line 40 def self.engine end |
.engine=(engine) ⇒ Object
47 48 |
# File 'lib/livescript.rb', line 47 def self.engine=(engine) end |
.version ⇒ Object
43 44 45 |
# File 'lib/livescript.rb', line 43 def self.version LiveScript::VERSION end |