Sha256: f6a5d6dcad3dcc0bf779227a9fd9fdabaac4ff20afa3aac3069034befd77bffc

Contents?: true

Size: 599 Bytes

Versions: 1

Compression:

Stored size: 599 Bytes

Contents

class String
  def brace?
    @brace ||= self[0] == '{'
  end

  def bracket?
    @bracket ||= self[0] == '['
  end

  def quote?
    @quote ||= self[0] == '"'
  end

  def parenthesis?
    brace? || bracket? || quote?
  end

  def to_tcl_string
    if parenthesis?
      if (brace? && self[-1] == '}') || (quote? && self[-1] == '"')
        b = self[1..-2]
        clear << b
      end
    end
    self
  end

  def to_tcl_list
    if self == '' || match(/\s/)
      "{#{self}}"
    else
      self
    end
  end

  def init
    @brace = @bracket = @quote = nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tcl-ruby-0.1.1 lib/tcl/ruby/string.rb