Class: Parcels::FortitudeParcel
- Inherits:
-
Object
- Object
- Parcels::FortitudeParcel
show all
- Defined in:
- lib/parcels/fortitude_parcel.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(widget_tree, full_path) ⇒ FortitudeParcel
Returns a new instance of FortitudeParcel.
15
16
17
18
|
# File 'lib/parcels/fortitude_parcel.rb', line 15
def initialize(widget_tree, full_path)
@widget_tree = widget_tree
@full_path = full_path
end
|
Class Method Details
.is_fortitude_logical_path?(logical_path) ⇒ Boolean
11
12
13
|
# File 'lib/parcels/fortitude_parcel.rb', line 11
def self.is_fortitude_logical_path?(logical_path)
logical_path =~ /^#{Regexp.escape(logical_path_prefix_base)}/
end
|
.logical_path_prefix_base ⇒ Object
7
8
9
|
# File 'lib/parcels/fortitude_parcel.rb', line 7
def self.logical_path_prefix_base
"_parcels_"
end
|
Instance Method Details
#add_to_sprockets_context!(sprockets_context) ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/parcels/fortitude_parcel.rb', line 41
def add_to_sprockets_context!(sprockets_context)
if has_content?(sprockets_context)
sprockets_context.require_asset(logical_path)
else
sprockets_context.depend_on_asset(logical_path)
end
end
|
#all_tag_types ⇒ Object
63
64
65
|
# File 'lib/parcels/fortitude_parcel.rb', line 63
def all_tag_types
[ :alongside, :inline ]
end
|
#included_in_any_set?(set_names) ⇒ Boolean
32
33
34
35
36
37
38
39
|
# File 'lib/parcels/fortitude_parcel.rb', line 32
def included_in_any_set?(set_names)
if set_names.length == 0
true
else
result = (widget_class._parcels_get_sets(full_path) & set_names)
result.length > 0
end
end
|
#inspect ⇒ Object
24
25
26
|
# File 'lib/parcels/fortitude_parcel.rb', line 24
def inspect
"<#{self.class.name.demodulize} for #{widget_class}, tree #{widget_tree}>"
end
|
#tag ⇒ Object
49
50
51
|
# File 'lib/parcels/fortitude_parcel.rb', line 49
def tag
[ tag_type, widget_class ]
end
|
#tag_type ⇒ Object
67
68
69
|
# File 'lib/parcels/fortitude_parcel.rb', line 67
def tag_type
raise "must implement in #{self.class.name}"
end
|
#tag_types_that_must_come_before ⇒ Object
71
72
73
|
# File 'lib/parcels/fortitude_parcel.rb', line 71
def tag_types_that_must_come_before
raise "must implement in #{self.class.name}"
end
|
53
54
55
56
57
58
59
60
61
|
# File 'lib/parcels/fortitude_parcel.rb', line 53
def tags_that_must_come_before
out = tag_types_that_must_come_before.map { |tt| [ tt, widget_class ] }
widget_class.all_fortitude_superclasses.each do |superclass|
all_tag_types.each do |tt|
out << [ tt, superclass ]
end
end
out
end
|
#to_css(sprockets_context) ⇒ Object
75
76
77
|
# File 'lib/parcels/fortitude_parcel.rb', line 75
def to_css(sprockets_context)
raise "must implement in #{self.class.name}"
end
|
#to_s ⇒ Object
20
21
22
|
# File 'lib/parcels/fortitude_parcel.rb', line 20
def to_s
"<#{self.class.name.demodulize} for #{widget_class}>"
end
|
#usable? ⇒ Boolean
28
29
30
|
# File 'lib/parcels/fortitude_parcel.rb', line 28
def usable?
!! widget_class
end
|