Module: Card::Set::Type::CoffeeScript::Format

Extended by:
AbstractFormat
Defined in:
card/tmpsets/set/mod017-card-mod-script/type/coffee_script.rb,
card/tmpsets/set/mod016-card-mod-script/type/coffee_script.rb

Instance Method Summary collapse

Instance Method Details

#compile_coffee(script) ⇒ Object



25
26
27
28
29
30
31
# File 'card/tmpsets/set/mod017-card-mod-script/type/coffee_script.rb', line 25

def compile_coffee script
  ::CoffeeScript.compile script
rescue => e
  line_nr = e.to_s.match(/\[stdin\]:(\d*)/)&.capture(0)&.to_i
  line = script.lines[line_nr - 1] if line_nr
  raise Card::Error, "CoffeeScript::Error (#{card.name}): #{e.message}: #{line}"
end

#view: coreObject



21
22
23
# File 'card/tmpsets/set/mod017-card-mod-script/type/coffee_script.rb', line 21

view :core do
  compile_coffee _render_raw
end