Class: Pieces::RouteCompiler::ViewModel

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/pieces/route_compiler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeViewModel

Returns a new instance of ViewModel.



59
60
61
62
# File 'lib/pieces/route_compiler.rb', line 59

def initialize(*)
  super
  _prepare_context if respond_to?(:_prepare_context)
end

Instance Attribute Details

#asset_prefixObject

Returns the value of attribute asset_prefix.



50
51
52
# File 'lib/pieces/route_compiler.rb', line 50

def asset_prefix
  @asset_prefix
end

#envObject

Returns the value of attribute env.



49
50
51
# File 'lib/pieces/route_compiler.rb', line 49

def env
  @env
end

Instance Method Details

#compute_asset_path(path, options = {}) ⇒ Object



64
65
66
67
68
69
70
# File 'lib/pieces/route_compiler.rb', line 64

def compute_asset_path(path, options = {})
  if env.resolve!(path)
    File.join(asset_prefix || '/assets', path)
  else
    super
  end
end