class Fig::TokenizedString
Public Class Methods
new(segments, single_quoted, metacharacters)
click to toggle source
# File lib/fig/tokenized_string.rb, line 6 def initialize(segments, single_quoted, metacharacters) @segments = segments @single_quoted = single_quoted @metacharacters = metacharacters return end
Public Instance Methods
can_be_single_quoted?()
click to toggle source
# File lib/fig/tokenized_string.rb, line 18 def can_be_single_quoted?() return true if single_quoted? return @segments.all? {|segment| segment.type.nil?} end
single_quoted?()
click to toggle source
# File lib/fig/tokenized_string.rb, line 14 def single_quoted?() return @single_quoted end
to_double_quotable_string()
click to toggle source
# File lib/fig/tokenized_string.rb, line 41 def to_double_quotable_string() return to_escaped_string if ! single_quoted? return ( @segments.collect { |segment| segment.to_double_quotable_string @metacharacters } ).join '' end
to_escaped_string()
click to toggle source
# File lib/fig/tokenized_string.rb, line 29 def to_escaped_string() return ( @segments.collect {|segment| segment.to_escaped_string} ).join '' end
to_expanded_string(&block)
click to toggle source
# File lib/fig/tokenized_string.rb, line 23 def to_expanded_string(&block) return ( @segments.collect { |segment| segment.to_expanded_string(&block) } ).join '' end
to_single_quoted_string()
click to toggle source
# File lib/fig/tokenized_string.rb, line 33 def to_single_quoted_string() return to_escaped_string if single_quoted? return ( @segments.collect {|segment| segment.to_single_quoted_string} ).join '' end