Module: LiveScript

Defined in:
lib/livescript.rb,
lib/livescript/version.rb

Constant Summary collapse

VERSION =
'2.3.0'

Class Method Summary collapse

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, options = {})
  # Read content if script is IO object
  script = script.read if script.respond_to?(:read)

  options = @default_options.merge(options)

  @context.call('LiveScript.compile', script, options)
end

.contextObject



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_optionsObject



18
19
20
# File 'lib/livescript.rb', line 18

def self.default_options
  @default_options
end

.default_options=(options) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/livescript.rb', line 22

def self.default_options=(options)
  if options.nil? || !options.kind_of?(Hash)
    raise "Wrong parameter for default_options: #{options.inspect}"
  else
    @default_options = options
  end
end

.engineObject



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

.versionObject



43
44
45
# File 'lib/livescript.rb', line 43

def self.version
  LiveScript::VERSION
end