module Checker

Check HAML file syntax

Public Class Methods

check(filepath) click to toggle source

Check:

  • file exist

  • filename extension

  • and HAML syntax

@param filepath (String)

# File lib/asker/checker.rb, line 14
def self.check(filepath)
  unless File.exist? filepath
    puts Rainbow('File not found!').red.bright
    return false
  end
  unless File.extname(filepath) == '.haml'
    puts Rainbow('Only check HAML files!').yellow.bright
    return false
  end
  check_filepath(filepath)
end
check_filepath(filepath) click to toggle source

Check HAML syntax @param filepath (String)

# File lib/asker/checker.rb, line 29
def self.check_filepath(filepath)
  data = Data.new(filepath)
  data.check
  data.show_errors
  data.ok?
end