Class: PureScript::Template

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/purescript/template.rb

Overview

PureScript template implementation. See: purescript.org/

PureScript templates do not support object scopes, locals, or yield.

Constant Summary collapse

@@default_bare =
false

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_bareObject



13
14
15
# File 'lib/purescript/template.rb', line 13

def self.default_bare
  @@default_bare
end

.default_bare=(value) ⇒ Object



17
18
19
# File 'lib/purescript/template.rb', line 17

def self.default_bare=(value)
  @@default_bare = value
end

.default_no_wrapObject

DEPRECATED



22
23
24
# File 'lib/purescript/template.rb', line 22

def self.default_no_wrap
  @@default_bare
end

.default_no_wrap=(value) ⇒ Object

DEPRECATED



27
28
29
# File 'lib/purescript/template.rb', line 27

def self.default_no_wrap=(value)
  @@default_bare = value
end

.engine_initialized?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/purescript/template.rb', line 31

def self.engine_initialized?
  defined? ::PureScript
end

Instance Method Details

#allows_script?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/purescript/template.rb', line 50

def allows_script?
  false
end

#evaluate(scope, locals, &block) ⇒ Object



46
47
48
# File 'lib/purescript/template.rb', line 46

def evaluate(scope, locals, &block)
  @output ||= `psc #{file} --main`
end

#initialize_engineObject



35
36
37
# File 'lib/purescript/template.rb', line 35

def initialize_engine
  require_template_library 'purescript'
end

#prepareObject



39
40
41
42
43
44
# File 'lib/purescript/template.rb', line 39

def prepare
  puts "prepare"
  if !options.key?(:bare) and !options.key?(:no_wrap)
    options[:bare] = self.class.default_bare
  end
end