Methods

&   to_yaml   yaml_new   |  

Public Class methods

[Source]

     # File yaml/rubytypes.rb, line 254
254:     def Regexp.yaml_new( klass, tag, val )
255:         if String === val and val =~ /^\/(.*)\/([mix]*)$/
256:             val = { 'regexp' => $1, 'mods' => $2 }
257:         end
258:         if Hash === val
259:             mods = nil
260:             unless val['mods'].to_s.empty?
261:                 mods = 0x00
262:                 mods |= Regexp::EXTENDED if val['mods'].include?( 'x' )
263:                 mods |= Regexp::IGNORECASE if val['mods'].include?( 'i' )
264:                 mods |= Regexp::MULTILINE if val['mods'].include?( 'm' )
265:             end
266:             val.delete( 'mods' )
267:             r = YAML::object_maker( klass, {} )
268:             Regexp.instance_method(:initialize).
269:                   bind(r).
270:                   call( val.delete( 'regexp' ), mods )
271:             val.each { |k,v| r.instance_variable_set( k, v ) }
272:             r
273:         else
274:             raise YAML::TypeError, "Invalid Regular expression: " + val.inspect
275:         end
276:     end

Public Instance methods

[Source]

    # File eregex.rb, line 29
29:   def &(other)
30:     RegAnd.new(self, other)
31:   end

[Source]

     # File yaml/rubytypes.rb, line 277
277:         def to_yaml( opts = {} )
278:                 YAML::quick_emit( nil, opts ) do |out|
279:             if to_yaml_properties.empty?
280:                 out.scalar( taguri, self.inspect, :plain )
281:             else
282:                 out.map( taguri, to_yaml_style ) do |map|
283:                     src = self.inspect
284:                     if src =~ /\A\/(.*)\/([a-z]*)\Z/
285:                         map.add( 'regexp', $1 )
286:                         map.add( 'mods', $2 )
287:                     else
288:                                 raise YAML::TypeError, "Invalid Regular expression: " + src
289:                     end
290:                     to_yaml_properties.each do |m|
291:                         map.add( m, instance_variable_get( m ) )
292:                     end
293:                 end
294:             end
295:         end
296:         end

[Source]

    # File eregex.rb, line 26
26:   def |(other)
27:     RegOr.new(self, other)
28:   end

Search

Google

Ruby API Docs

Links