Class: String
Instance Method Summary collapse
-
#regex_path_match(re, trees, args, &block) ⇒ Object
:nodoc:.
- #symtbl_gsub(symtbl) ⇒ Object
- #symtbl_gsub!(symtbl) ⇒ Object
- #symtbl_to_s ⇒ Object
- #to_text(*args, &block) ⇒ Object
Instance Method Details
#regex_path_match(re, trees, args, &block) ⇒ Object
:nodoc:
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/r_path.rb', line 151 def regex_path_match ( re, trees, args, &block ) # :nodoc: seg, tail_re = re.split trees = (trees || []) + [self] if re.captured? if tail_re.empty? match_data = seg =~ self if seg.nil? or match_data trees ||= [self] else trees ||= [] end if seg.nil? or match_data or re.negative? args = args + match_data[1..-1] if defined? match_data and match_data trees.each { |tree| block[tree, *args] } end end end |
#symtbl_gsub(symtbl) ⇒ Object
196 197 198 199 |
# File 'lib/sym_tbl_gsub.rb', line 196 def symtbl_gsub ( symtbl ) return nil unless self =~ /<<.*>>/ dup.symtbl_gsub! symtbl end |
#symtbl_gsub!(symtbl) ⇒ Object
203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/sym_tbl_gsub.rb', line 203 def symtbl_gsub! ( symtbl ) have_changed = nil while ( gsub!(/<<([^<>]*)>>/) do s = symtbl[$1] have_changed ||= s (s.nil?)? "<#{@@tag}<#$1>#{@@tag}>" : s.symtbl_to_s end ) do end gsub! @@tag, '' return nil if have_changed.nil? self end |
#symtbl_to_s ⇒ Object
192 193 194 |
# File 'lib/sym_tbl_gsub.rb', line 192 def symtbl_to_s self end |