class Roll::Amp::Style::CompiledStylesheetFile

The stylesheet file, compiled into Rails app public directory.

Public Class Methods

new(app_path, stylesheet_name) click to toggle source

Initializes new instance of the compiled stylesheet file. @param app_path [String] the Rails application root path. @param stylesheet_name [String] the stylesheet file name.

# File lib/roll/amp/style/compiled_stylesheet_file.rb, line 9
def initialize(app_path, stylesheet_name)
  @path = CompiledStylesheetPath.new(app_path, stylesheet_name)
end

Public Instance Methods

read() click to toggle source

Reads content of the file. @return [String] the file content or empty string if file doesn't exist.

# File lib/roll/amp/style/compiled_stylesheet_file.rb, line 16
def read
  full_stylesheet_path = @path.full
  if File.file?(full_stylesheet_path) &&
     File.exist?(full_stylesheet_path)
    File.read(full_stylesheet_path)
  else
    ''
  end
end