module Prettyrb::Nodes::StringHelper
Constants
- HEREDOC_TYPE_REGEX
Public Instance Methods
closing_delimiter()
click to toggle source
# File lib/prettyrb/nodes/string_helper.rb, line 18 def closing_delimiter loc.expression.source.rstrip[-1] end
heredoc?()
click to toggle source
# File lib/prettyrb/nodes/string_helper.rb, line 38 def heredoc? !!loc.respond_to?(:heredoc_body) end
heredoc_body()
click to toggle source
# File lib/prettyrb/nodes/string_helper.rb, line 34 def heredoc_body loc.heredoc_body.source end
heredoc_identifier()
click to toggle source
# File lib/prettyrb/nodes/string_helper.rb, line 22 def heredoc_identifier loc.heredoc_end.source.strip end
heredoc_type()
click to toggle source
# File lib/prettyrb/nodes/string_helper.rb, line 26 def heredoc_type # Always use indentable ending heredoc type if no type was provided # # eg: <<RUBY becomes <<-RUBY since <<- allows the ending identifier # to be indented loc.expression.source.match(HEREDOC_TYPE_REGEX)[1] || "-" end
percent_character()
click to toggle source
# File lib/prettyrb/nodes/string_helper.rb, line 10 def percent_character loc.expression.source[1] end
percent_string?()
click to toggle source
# File lib/prettyrb/nodes/string_helper.rb, line 6 def percent_string? loc.expression.source.start_with?("%") end
start_delimiter()
click to toggle source
# File lib/prettyrb/nodes/string_helper.rb, line 14 def start_delimiter loc.expression.source[2] end