### Home Classes Methods

### In Files

- lib/chronic/mini_date.rb

### Parent

Object

### Methods

- ::from_time
- ::new
- #equals?
- #is_between?

### 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::MiniDate

### Attributes

day[RW]
month[RW]

### Public Class Methods

from_time(time) click to toggle source

    # File lib/chronic/mini_date.rb, line 5
    def self.from_time(time)
      new(time.month, time.day)
    end

new(month, day) click to toggle source

    # File lib/chronic/mini_date.rb, line 9
    def initialize(month, day)
      unless (1..12).include?(month)
        raise ArgumentError, "1..12 are valid months"
      end

      @month = month
      @day = day
    end

### Public Instance Methods

equals?(other) click to toggle source

    # File lib/chronic/mini_date.rb, line 34
    def equals?(other)
      @month == other.month and @day == other.day
    end

is_between?(md_start, md_end) click to toggle source

    # File lib/chronic/mini_date.rb, line 18
    def is_between?(md_start, md_end)
      return false if (@month == md_start.month && @month == md_end.month) &&
                      (@day < md_start.day || @day > md_end.day)
      return true if (@month == md_start.month && @day >= md_start.day) ||
                     (@month == md_end.month && @day <= md_end.day)

      i = (md_start.month % 12) + 1

      until i == md_end.month
        return true if @month == i
        i = (i % 12) + 1
      end

      return false
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.