class HamlLint::Tree::SilentScriptNode
Represents a HAML silent script node (‘- some_expression`) which executes code without producing output.
Public Instance Methods
parsed_script()
click to toggle source
The Ruby script contents parsed into a syntax tree.
@return [ParsedRuby] syntax tree in the form returned by Parser gem
# File lib/haml_lint/tree/silent_script_node.rb, line 10 def parsed_script statement = case keyword = @value[:keyword] when 'else', 'elsif' 'if 0;' + script + ';end' when 'when' 'case;' + script + ';end' when 'rescue', 'ensure' 'begin;' + script + ';end' else if children.empty? script else "#{script}#{keyword == 'case' ? ';when 0;end' : ';end'}" end end HamlLint::ParsedRuby.new(HamlLint::RubyParser.new.parse(statement)) end
script()
click to toggle source
Returns the source for the script following the ‘-` marker.
@return [String]
# File lib/haml_lint/tree/silent_script_node.rb, line 32 def script @value[:text] end