class RailsRouteChecker::Parsers::HamlParser::Tree::TagNode
Public Instance Methods
attributes_source()
click to toggle source
# File lib/rails-route-checker/parsers/haml_parser/tree/tag_node.rb, line 22 def attributes_source @attr_source ||= # rubocop:disable Naming/MemoizedInstanceVariableName begin _explicit_tag, static_attrs, rest = source_code.scan(/\A\s*(%[-:\w]+)?([-:\w\.\#]*)(.*)/m)[0] attr_types = { '{' => [:hash, %w[{ }]], '(' => [:html, %w[( )]], '[' => [:object_ref, %w[[ ]]] } attr_source = { static: static_attrs } while rest type, chars = attr_types[rest[0]] break unless type break if attr_source[type] attr_source[type], rest = Haml::Util.balance(rest, *chars) end attr_source end end
dynamic_attributes_source()
click to toggle source
# File lib/rails-route-checker/parsers/haml_parser/tree/tag_node.rb, line 17 def dynamic_attributes_source @dynamic_attributes_source ||= attributes_source.reject { |key| key == :static } end
dynamic_attributes_sources()
click to toggle source
# File lib/rails-route-checker/parsers/haml_parser/tree/tag_node.rb, line 8 def dynamic_attributes_sources @dynamic_attributes_sources ||= if Gem::Version.new(Haml::VERSION) < Gem::Version.new('5') @value[:attributes_hashes] else Array(@value[:dynamic_attributes].to_literal).reject(&:empty?) end end
hash_attributes?()
click to toggle source
# File lib/rails-route-checker/parsers/haml_parser/tree/tag_node.rb, line 47 def hash_attributes? !dynamic_attributes_source[:hash].nil? end
script()
click to toggle source
# File lib/rails-route-checker/parsers/haml_parser/tree/tag_node.rb, line 51 def script (@value[:value] if @value[:parse]) || '' end