Flowdock
method

parse!

Importance_0
v5.0.0.1 - Show latest stable - 0 notes - Class: ISO8601Parser
parse!() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activesupport/lib/active_support/duration/iso8601_parser.rb, line 39
      def parse!
        while !finished?
          case mode
            when :start
              if scan(SIGN_MARKER)
                self.sign = (scanner.matched == '-') ? -1 : 1
                self.mode = :sign
              else
                raise_parsing_error
              end

            when :sign
              if scan(DATE_MARKER)
                self.mode = :date
              else
                raise_parsing_error
              end

            when :date
              if scan(TIME_MARKER)
                self.mode = :time
              elsif scan(DATE_COMPONENT)
                parts[DATE_TO_PART[scanner[2]]] = number * sign
              else
                raise_parsing_error
              end

            when :time
              if scan(TIME_COMPONENT)
                parts[TIME_TO_PART[scanner[2]]] = number * sign
              else
                raise_parsing_error
              end

          end
        end

        validate!
        parts
      end
Register or log in to add new notes.