Class: RegexpTree::Seq

Inherits:
RegexpTree show all
Defined in:
lib/regexptree.rb

Constant Summary

Constants inherited from RegexpTree

EmptySequence, EmptySet

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RegexpTree

#*, #+, alt, backref, charclass, #closure, #empty_set?, #group, inherited, #inspect, linebeg, lineend, #lookahead, #negative_lookahead, non_word_boundary, #nongreedy_closure, #nongreedy_ntimes, #nongreedy_optional, #nongreedy_positive_closure, #nongreedy_rep, #ntimes, #optional, #paren, #parenthesize, #positive_closure, #pretty_print, previous_match, #regexp, #rep, rep, seq, str, strbeg, strend, strlineend, #to_s, word_boundary, #|

Constructor Details

#initialize(rs) ⇒ Seq

Returns a new instance of Seq.



225
226
227
# File 'lib/regexptree.rb', line 225

def initialize(rs)
  @rs = rs
end

Instance Attribute Details

#rsObject (readonly)

Returns the value of attribute rs.



228
229
230
# File 'lib/regexptree.rb', line 228

def rs
  @rs
end

Instance Method Details

#case_insensitive?Boolean

Returns:

  • (Boolean)


234
235
236
# File 'lib/regexptree.rb', line 234

def case_insensitive?
  @rs.all? {|r| r.case_insensitive?}
end

#downcaseObject



242
243
244
# File 'lib/regexptree.rb', line 242

def downcase
  Seq.new(@rs.map {|r| r.downcase})
end

#empty_sequence?Boolean

Returns:

  • (Boolean)


230
231
232
# File 'lib/regexptree.rb', line 230

def empty_sequence?
  @rs.empty?
end

#multiline_insensitive?Boolean

Returns:

  • (Boolean)


238
239
240
# File 'lib/regexptree.rb', line 238

def multiline_insensitive?
  @rs.all? {|r| r.multiline_insensitive?}
end

#pretty_format(out) ⇒ Object



246
247
248
249
250
251
252
253
254
255
# File 'lib/regexptree.rb', line 246

def pretty_format(out)
  out.group {
	@rs.each_with_index {|r, i|
	  unless i == 0
 out.group {out.breakable ''}
	  end
	  r.parenthesize(Seq).pretty_format(out)
	}
  }
end