Module: Staticz::Compilable

Included in:
Cs, Haml, Js, Sass, Scss
Defined in:
lib/manifest/compilable.rb

Instance Method Summary collapse

Instance Method Details

#build_pathObject



11
12
13
# File 'lib/manifest/compilable.rb', line 11

def build_path
  "build/#{name}.#{build_file_ending}"
end


31
32
33
34
# File 'lib/manifest/compilable.rb', line 31

def create_link_function
  link_path = "#{name}.#{build_file_ending}"
  Object.send(:define_method, path_method_name) { link_path }
end

#exists?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/manifest/compilable.rb', line 15

def exists?
  File.exist? source_path
end

#pathObject



3
4
5
# File 'lib/manifest/compilable.rb', line 3

def path
  name.to_s
end

#path_method_nameObject



19
20
21
# File 'lib/manifest/compilable.rb', line 19

def path_method_name
  "#{path.gsub(/[\/-]/, "_")}_path"
end


36
37
38
# File 'lib/manifest/compilable.rb', line 36

def print(indentation)
  puts "#{" " * (indentation * 3)}└─ #{tile_type_name}: #{path} #{valid} -> #{path_method_name}"
end

#source_pathObject



7
8
9
# File 'lib/manifest/compilable.rb', line 7

def source_path
  "src/#{name}.#{source_file_ending}"
end

#validObject



23
24
25
26
27
28
29
# File 'lib/manifest/compilable.rb', line 23

def valid
  if exists?
    Colors.in_green("")
  else
    Colors.in_red("✘ (file does not exist)")
  end
end