Class: Paste::Parser::Sprockets

Inherits:
Object
  • Object
show all
Defined in:
lib/paste/parser/sprockets.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(glue, sources) ⇒ Sprockets

Returns a new instance of Sprockets.



11
12
13
14
15
# File 'lib/paste/parser/sprockets.rb', line 11

def initialize glue, sources
  @glue      = glue
  @sources   = sources
  reset!
end

Instance Attribute Details

#glueObject (readonly)

Returns the value of attribute glue.



7
8
9
# File 'lib/paste/parser/sprockets.rb', line 7

def glue
  @glue
end

#secretaryObject (readonly)

Returns the value of attribute secretary.



7
8
9
# File 'lib/paste/parser/sprockets.rb', line 7

def secretary
  @secretary
end

#sourcesObject (readonly)

Returns the value of attribute sources.



7
8
9
# File 'lib/paste/parser/sprockets.rb', line 7

def sources
  @sources
end

Instance Method Details

#css_dependenciesObject



22
23
24
25
# File 'lib/paste/parser/sprockets.rb', line 22

def css_dependencies
  generate_dependencies if @css_dependencies.nil?
  @css_dependencies
end

#js_dependenciesObject



17
18
19
20
# File 'lib/paste/parser/sprockets.rb', line 17

def js_dependencies
  generate_dependencies if @js_dependencies.nil?
  @js_dependencies
end

#reset!Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/paste/parser/sprockets.rb', line 27

def reset!
  @js_dependencies = @css_dependencies = nil

  @secretary = ::Sprockets::Secretary.new(
    :root         => glue.root, 
    :expand_paths => false,
    :load_path    => glue.load_path,
    :source_files => @sources.map{ |s| glue.find s }
  )
rescue ::Sprockets::LoadError => e
  raise ResolveError.new(e.message)
end