class Parcels::FortitudeParcel
Attributes
full_path[R]
widget_tree[R]
Public Class Methods
is_fortitude_logical_path?(logical_path)
click to toggle source
# 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()
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 7 def self.logical_path_prefix_base "_parcels_" end
new(widget_tree, full_path)
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 15 def initialize(widget_tree, full_path) @widget_tree = widget_tree @full_path = full_path end
Public Instance Methods
add_to_sprockets_context!(sprockets_context)
click to toggle source
# 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()
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 63 def all_tag_types [ :alongside, :inline ] end
included_in_any_set?(set_names)
click to toggle source
# 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()
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 24 def inspect "<#{self.class.name.demodulize} for #{widget_class}, tree #{widget_tree}>" end
tag()
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 49 def tag [ tag_type, widget_class ] end
tag_type()
click to toggle source
# 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()
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 71 def tag_types_that_must_come_before raise "must implement in #{self.class.name}" end
to_css(sprockets_context)
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 75 def to_css(sprockets_context) raise "must implement in #{self.class.name}" end
to_s()
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 20 def to_s "<#{self.class.name.demodulize} for #{widget_class}>" end
usable?()
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 28 def usable? !! widget_class end
Private Instance Methods
has_content?(sprockets_context)
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 82 def has_content?(sprockets_context) !! to_css(sprockets_context) end
logical_path()
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 90 def logical_path @logical_path ||= File.join(self.class.logical_path_prefix, subpath) end
subpath()
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 86 def subpath @subpath ||= widget_tree.subpath_to(full_path) end
widget_class()
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 98 def widget_class @widget_class ||= begin if widget_class_full_path begin ::Fortitude::Widget.widget_class_from_file(widget_class_full_path, :root_dirs => widget_tree.widget_naming_root_dirs) rescue ::Fortitude::Widget::Files::CannotDetermineWidgetClassNameError => cdwcne raise unless cdwcne.resulting_objects.detect { |o| o.kind_of?(Module) } :none end else :none end end @widget_class unless @widget_class == :none end
widget_class_full_path()
click to toggle source
# File lib/parcels/fortitude_parcel.rb, line 94 def widget_class_full_path raise "must implement in #{self.class.name}" end