Regexp (Class)

In: yaml/rubytypes.rb
Parent: Object

Make an Regexp

Methods

Public Instance methods

[Source]

# File yaml/rubytypes.rb, line 449
    def is_complex_yaml?
        self.class != Regexp or not to_yaml_properties.empty?
    end

[Source]

# File yaml/rubytypes.rb, line 455
        def to_yaml( opts = {} )
                YAML::quick_emit( nil, opts ) { |out|
            if self.is_complex_yaml?
                out.map( self.to_yaml_type ) { |map|
                    src = self.inspect
                    if src =~ /\A\/(.*)\/([a-z]*)\Z/
                        map.add( 'regexp', $1 )
                        map.add( 'mods', $2 )
                    else
                                raise YAML::Error, "Invalid Regular expression: " + src
                    end
                    to_yaml_properties.each { |m|
                        map.add( m, instance_variable_get( m ) )
                    }
                }
            else
                out << "#{ to_yaml_type } "
                self.inspect.to_yaml( :Emitter => out )
            end
                }
        end

[Source]

# File yaml/rubytypes.rb, line 452
    def to_yaml_type
        "!ruby/regexp#{ if self.class != ::Regexp; ":#{ self.class }"; end }"
    end

[Validate]