### Home Classes Methods

### In Files

- lib/chronic/span.rb

### Parent

Range

### Methods

- #+
- #-
- #to_s
- #width

### Files

- LICENSE

### Class/Module Index

Quicksearch

- Chronic
- Chronic::Date
- Chronic::Grabber
- Chronic::Handler
- Chronic::Handlers
- Chronic::MiniDate
- Chronic::Numerizer
- Chronic::Ordinal
- Chronic::Parser
- Chronic::Pointer
- Chronic::Repeater
- Chronic::Scalar
- Chronic::Season
- Chronic::Separator
- Chronic::Sign
- Chronic::Span
- Chronic::Tag
- Chronic::Time
- Chronic::TimeZone
- Chronic::Token

No matching classes.

# Chronic::Span

A Span represents a range of time. Since this class extends Range, you can use begin and end to get the beginning and ending times of the span (they will be of class Time)

### Public Instance Methods

+(seconds) click to toggle source

Add a number of seconds to this span, returning the resulting Span

    # File lib/chronic/span.rb, line 13
    def +(seconds)
      Span.new(self.begin + seconds, self.end + seconds)
    end

-(seconds) click to toggle source

Subtract a number of seconds to this span, returning the resulting Span

    # File lib/chronic/span.rb, line 19
    def -(seconds)
      self + -seconds
    end

to_s() click to toggle source

Prints this span in a nice fashion

    # File lib/chronic/span.rb, line 24
    def to_s
      '(' << self.begin.to_s << '..' << self.end.to_s << ')'
    end

width() click to toggle source

Returns the width of this span in seconds

    # File lib/chronic/span.rb, line 7
    def width
      (self.end - self.begin).to_i
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.