Parent

Class Index [+]

Quicksearch

ActiveLdap::Ldif::Scanner

Constants

SEPARATOR
SEPARATORS

Public Class Methods

new(source) click to toggle source
     # File lib/active_ldap/ldif.rb, line 501
501:       def initialize(source)
502:         @source = source
503:         @scanner = StringScanner.new(@source)
504:         @sub_scanner = nil
505:         @sub_scanner = next_segment || StringScanner.new("")
506:       end

Public Instance Methods

[](*args) click to toggle source
     # File lib/active_ldap/ldif.rb, line 543
543:       def [](*args)
544:         @sub_scanner[*args]
545:       end
check(regexp) click to toggle source
     # File lib/active_ldap/ldif.rb, line 513
513:       def check(regexp)
514:         @sub_scanner = next_segment if @sub_scanner.eos?
515:         @sub_scanner.check(regexp)
516:       end
check_separator() click to toggle source
     # File lib/active_ldap/ldif.rb, line 524
524:       def check_separator
525:         return @scanner.check(SEPARATOR) if @sub_scanner.eos?
526: 
527:         check(SEPARATOR)
528:       end
column() click to toggle source
     # File lib/active_ldap/ldif.rb, line 561
561:       def column
562:         _consumed_source = consumed_source
563:         return 1 if _consumed_source.empty?
564: 
565:         position - (_consumed_source.rindex("\n") || 1)
566:       end
eos?() click to toggle source
     # File lib/active_ldap/ldif.rb, line 547
547:       def eos?
548:         @sub_scanner = next_segment if @sub_scanner.eos?
549:         @sub_scanner.eos? and @scanner.eos?
550:       end
line() click to toggle source
     # File lib/active_ldap/ldif.rb, line 552
552:       def line
553:         _consumed_source = consumed_source
554:         return 1 if _consumed_source.empty?
555: 
556:         n = Compatible.string_to_lines(_consumed_source).size
557:         n += 1 if _consumed_source[1, 1] == "\n"
558:         n
559:       end
position() click to toggle source
     # File lib/active_ldap/ldif.rb, line 568
568:       def position
569:         sub_scanner_string = @sub_scanner.string
570:         if sub_scanner_string.respond_to?(:bytesize)
571:           sub_scanner_string_size = sub_scanner_string.bytesize
572:         else
573:           sub_scanner_string_size = sub_scanner_string.size
574:         end
575:         @scanner.pos - (sub_scanner_string_size - @sub_scanner.pos)
576:       end
scan(regexp) click to toggle source
     # File lib/active_ldap/ldif.rb, line 508
508:       def scan(regexp)
509:         @sub_scanner = next_segment if @sub_scanner.eos?
510:         @sub_scanner.scan(regexp)
511:       end
scan_separator() click to toggle source
     # File lib/active_ldap/ldif.rb, line 518
518:       def scan_separator
519:         return @scanner.scan(SEPARATOR) if @sub_scanner.eos?
520: 
521:         scan(SEPARATOR)
522:       end
scan_separators() click to toggle source
     # File lib/active_ldap/ldif.rb, line 530
530:       def scan_separators
531:         return @scanner.scan(SEPARATORS) if @sub_scanner.eos?
532: 
533:         sub_result = scan(SEPARATORS)
534:         return nil if sub_result.nil?
535:         return sub_result unless @sub_scanner.eos?
536: 
537:         result = @scanner.scan(SEPARATORS)
538:         return sub_result if result.nil?
539: 
540:         sub_result + result
541:       end

Private Instance Methods

consumed_source() click to toggle source
     # File lib/active_ldap/ldif.rb, line 588
588:       def consumed_source
589:         @source[0, position]
590:       end
next_segment() click to toggle source
     # File lib/active_ldap/ldif.rb, line 579
579:       def next_segment
580:         loop do
581:           segment = @scanner.scan(/.+(?:#{SEPARATOR} .*)*#{SEPARATOR}?/)
582:           return @sub_scanner if segment.nil?
583:           next if segment[0, 1] == "#"
584:           return StringScanner.new(segment.gsub(/\r?\n /, ''))
585:         end
586:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.