Class: ReflexBehaviors::TagBuilders::BaseTagBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/reflex_behaviors/tag_builders/base_tag_builder.rb

Direct Known Subclasses

ToggleTagsBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view_context) ⇒ BaseTagBuilder

Returns a new instance of BaseTagBuilder.



9
10
11
# File 'lib/reflex_behaviors/tag_builders/base_tag_builder.rb', line 9

def initialize(view_context)
  @view_context = view_context
end

Instance Attribute Details

#view_contextObject (readonly)

Returns the value of attribute view_context.



6
7
8
# File 'lib/reflex_behaviors/tag_builders/base_tag_builder.rb', line 6

def view_context
  @view_context
end

Instance Method Details

#view_stackObject



13
14
15
16
17
18
19
# File 'lib/reflex_behaviors/tag_builders/base_tag_builder.rb', line 13

def view_stack
  prefix = "app/views/"
  locations = caller_locations.select { |location| location.path.include?(prefix) }
  locations.each_with_object(Set.new) do |location, memo|
    memo << location.path[(location.path.index(prefix) + prefix.length)..]
  end
end