Class: Roll::Amp::Style::CompiledStylesheetPath

Inherits:
Object
  • Object
show all
Defined in:
lib/roll/amp/style/compiled_stylesheet_path.rb

Overview

The path of a stylesheet file, compiled into Rails app ‘public` directory.

Instance Method Summary collapse

Constructor Details

#initialize(app_path, stylesheet_name) ⇒ CompiledStylesheetPath

Initializes new instance of the path of a compiled stylesheet file.

Parameters:

  • app_path (String)

    the Rails application root path.

  • stylesheet_name (String)

    the stylesheet file name.



12
13
14
15
# File 'lib/roll/amp/style/compiled_stylesheet_path.rb', line 12

def initialize(app_path, stylesheet_name)
  @app_path = app_path
  @stylesheet_name = stylesheet_name
end

Instance Method Details

#fullString

Uses ActionView to obtain full stylesheet path in ‘public` directory.

Returns:

  • (String)

    the full path string. Always has value.



19
20
21
22
23
24
25
# File 'lib/roll/amp/style/compiled_stylesheet_path.rb', line 19

def full
  stylesheet_file = ActionView::Base.new.stylesheet_path(
    @stylesheet_name,
    host: nil
  )
  "#{@app_path}/public#{stylesheet_file}"
end