Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/tcl/ruby/string.rb
Instance Method Summary collapse
- #brace? ⇒ Boolean
- #bracket? ⇒ Boolean
- #init ⇒ Object
- #parenthesis? ⇒ Boolean
- #quote? ⇒ Boolean
- #to_tcl_list ⇒ Object
- #to_tcl_string ⇒ Object
Instance Method Details
#brace? ⇒ Boolean
2 3 4 |
# File 'lib/tcl/ruby/string.rb', line 2 def brace? @brace ||= self[0] == '{' end |
#bracket? ⇒ Boolean
6 7 8 |
# File 'lib/tcl/ruby/string.rb', line 6 def bracket? @bracket ||= self[0] == '[' end |
#init ⇒ Object
36 37 38 |
# File 'lib/tcl/ruby/string.rb', line 36 def init @brace = @bracket = @quote = nil end |
#parenthesis? ⇒ Boolean
14 15 16 |
# File 'lib/tcl/ruby/string.rb', line 14 def parenthesis? brace? || bracket? || quote? end |
#quote? ⇒ Boolean
10 11 12 |
# File 'lib/tcl/ruby/string.rb', line 10 def quote? @quote ||= self[0] == '"' end |
#to_tcl_list ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/tcl/ruby/string.rb', line 28 def to_tcl_list if self == '' || match(/\s/) "{#{self}}" else self end end |
#to_tcl_string ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/tcl/ruby/string.rb', line 18 def to_tcl_string if parenthesis? if (brace? && self[-1] == '}') || (quote? && self[-1] == '"') b = self[1..-2] clear << b end end self end |