Class: Datify::Engine

Inherits:
Object
  • Object
show all
Includes:
Language
Defined in:
lib/datify/engine.rb

Constant Summary

Constants included from Language

Language::MONTHS_IT

Instance Attribute Summary collapse

Attributes included from Language

#lang

Instance Method Summary collapse

Methods included from Language

#default_language, #get_month, #set_language

Constructor Details

#initialize(string = nil) ⇒ Engine

Returns a new instance of Engine.



8
9
10
11
# File 'lib/datify/engine.rb', line 8

def initialize(string = nil)
  default_language
  @array = parse_string(string)
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



6
7
8
# File 'lib/datify/engine.rb', line 6

def date
  @date
end

Instance Method Details

#parse_string(string) ⇒ Object



17
18
19
# File 'lib/datify/engine.rb', line 17

def parse_string(string)
  (string.nil?) ? [] : string.split('-') 
end

#valid?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/datify/engine.rb', line 21

def valid?
  ((@array.size == 3) && (get_month(@array[1]) != @array[1]))
end