Class: Tau::Engines::AbstractEngine

Inherits:
Object
  • Object
show all
Defined in:
lib/tau/engines/abstract_engine.rb

Direct Known Subclasses

Coffee, Haml, Sass, Scss

Class Method Summary collapse

Class Method Details

.can_render_from?(filename) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/tau/engines/abstract_engine.rb', line 30

def can_render_from?(filename)
  filename.end_with?(render_from) and File.exist?(filename)
end

.can_render_to?(filename) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/tau/engines/abstract_engine.rb', line 26

def can_render_to?(filename)
  filename.end_with?(render_to) and source_exist?(filename)
end

.dst_exist?(source) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/tau/engines/abstract_engine.rb', line 18

def dst_exist?(source)
  File.exist? dst_for(source)
end

.dst_for(source) ⇒ Object



22
23
24
# File 'lib/tau/engines/abstract_engine.rb', line 22

def dst_for(source)
  source.sub(/\.#{render_from}\z/, ".#{render_to}")
end

.render_file(filename) ⇒ Object



6
7
8
# File 'lib/tau/engines/abstract_engine.rb', line 6

def render_file(filename)
  render File.read(filename)
end

.source_exist?(dst) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/tau/engines/abstract_engine.rb', line 10

def source_exist?(dst)
  File.exist? source_for(dst)
end

.source_for(dst) ⇒ Object



14
15
16
# File 'lib/tau/engines/abstract_engine.rb', line 14

def source_for(dst)
  dst.sub(/\.#{render_to}\z/, ".#{render_from}")
end