Class: Lanes::Extensions::Definition
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Definition.
31
32
33
|
# File 'lib/lanes/extension/definition.rb', line 31
def initialize
self.add_to_load_path
end
|
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
11
12
13
|
# File 'lib/lanes/extension/definition.rb', line 11
def context
@context
end
|
Class Method Details
.components(*names) ⇒ Object
27
28
29
|
# File 'lib/lanes/extension/definition.rb', line 27
def self.components(*names)
Components.enable(*names)
end
|
.inherited(klass) ⇒ Object
7
8
9
|
# File 'lib/lanes/extension/definition.rb', line 7
def self.inherited(klass)
Extensions.add(klass)
end
|
Instance Method Details
#add_to_load_path ⇒ Object
89
90
91
92
93
94
|
# File 'lib/lanes/extension/definition.rb', line 89
def add_to_load_path
@in_load_path_set ||= (
lib = root_path.join('lib').to_s
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
)
end
|
#client_bootstrap_data(view) ⇒ Object
43
44
45
|
# File 'lib/lanes/extension/definition.rb', line 43
def client_bootstrap_data(view)
{}
end
|
#client_namespace ⇒ Object
55
56
57
|
# File 'lib/lanes/extension/definition.rb', line 55
def client_namespace
identifier.underscore.camelize
end
|
#client_paths ⇒ Object
59
60
61
|
# File 'lib/lanes/extension/definition.rb', line 59
def client_paths
[ root_path.join('client') ]
end
|
#each_static_asset ⇒ Object
71
72
73
74
75
76
77
|
# File 'lib/lanes/extension/definition.rb', line 71
def each_static_asset
static_paths.each do | path |
path.find.each do | entry |
yield entry if entry.file?
end
end
end
|
#javascript_include ⇒ Object
51
52
53
|
# File 'lib/lanes/extension/definition.rb', line 51
def javascript_include
self.identifier
end
|
#load_after(extension) ⇒ Object
35
36
37
|
# File 'lib/lanes/extension/definition.rb', line 35
def load_after(extension)
self.after = extension
end
|
#load_before(extension) ⇒ Object
39
40
41
|
# File 'lib/lanes/extension/definition.rb', line 39
def load_before(extension)
self.before = extension
end
|
#on_boot ⇒ Object
86
87
|
# File 'lib/lanes/extension/definition.rb', line 86
def on_boot
end
|
#route(route_set) ⇒ Object
79
80
81
82
83
84
|
# File 'lib/lanes/extension/definition.rb', line 79
def route(route_set)
routes_config = root_path.join('config','routes.rb')
if routes_config.exist?
require routes_config
end
end
|
#static_paths ⇒ Object
63
64
65
66
67
68
69
|
# File 'lib/lanes/extension/definition.rb', line 63
def static_paths
client_paths.each_with_object(Array.new) do |path, result|
Lanes.config.static_asset_types.each do | prefix |
result << path.join(prefix) if path.join(prefix).exist?
end
end
end
|
#stylesheet_include ⇒ Object
47
48
49
|
# File 'lib/lanes/extension/definition.rb', line 47
def stylesheet_include
self.identifier + '/styles'
end
|