Class: FuzzyDate

Inherits:
Object
  • Object
show all
Defined in:
lib/fuzzy-date.rb,
lib/fuzzy-date/analyze.rb,
lib/fuzzy-date/variables.rb,
lib/fuzzy-date/fuzzy-date.rb

Constant Summary collapse

VERSION =
'0.2.1'
DATE_SEPARATOR =
'[^A-Za-z0-9]'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date, euro = false) ⇒ FuzzyDate

Returns a new instance of FuzzyDate.



3
4
5
6
# File 'lib/fuzzy-date/fuzzy-date.rb', line 3

def initialize( date, euro = false )
  setup
  analyze date, euro
end

Instance Attribute Details

#circaObject (readonly)

Returns the value of attribute circa.



5
6
7
# File 'lib/fuzzy-date/analyze.rb', line 5

def circa
  @circa
end

#dayObject (readonly)

Returns the value of attribute day.



5
6
7
# File 'lib/fuzzy-date/analyze.rb', line 5

def day
  @day
end

#eraObject (readonly)

Returns the value of attribute era.



5
6
7
# File 'lib/fuzzy-date/analyze.rb', line 5

def era
  @era
end

#fixedObject (readonly)

Returns the value of attribute fixed.



5
6
7
# File 'lib/fuzzy-date/analyze.rb', line 5

def fixed
  @fixed
end

#fullObject (readonly)

Returns the value of attribute full.



5
6
7
# File 'lib/fuzzy-date/analyze.rb', line 5

def full
  @full
end

#longObject (readonly)

Returns the value of attribute long.



5
6
7
# File 'lib/fuzzy-date/analyze.rb', line 5

def long
  @long
end

#monthObject (readonly)

Returns the value of attribute month.



5
6
7
# File 'lib/fuzzy-date/analyze.rb', line 5

def month
  @month
end

#month_nameObject (readonly)

Returns the value of attribute month_name.



5
6
7
# File 'lib/fuzzy-date/analyze.rb', line 5

def month_name
  @month_name
end

#originalObject (readonly)

Returns the value of attribute original.



5
6
7
# File 'lib/fuzzy-date/analyze.rb', line 5

def original
  @original
end

#shortObject (readonly)

Returns the value of attribute short.



5
6
7
# File 'lib/fuzzy-date/analyze.rb', line 5

def short
  @short
end

#yearObject (readonly)

Returns the value of attribute year.



5
6
7
# File 'lib/fuzzy-date/analyze.rb', line 5

def year
  @year
end

Class Method Details

.parse(date, euro = false) ⇒ Object



8
9
10
# File 'lib/fuzzy-date.rb', line 8

def self.parse( date, euro = false )
  FuzzyDate.new date, euro
end

Instance Method Details

#to_hashObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fuzzy-date/fuzzy-date.rb', line 8

def to_hash
  {
    circa:      @circa,
    day:        @day,
    era:        @era,
    fixed:      @fixed,
    full:       @full,
    long:       @long,
    month:      @month,
    month_name: @month_name,
    original:   @original,
    short:      @short,
    year:       @year
  }
end