Module: Castiel

Defined in:
lib/castiel.rb,
lib/castiel/version.rb,
lib/castiel/parsers/base_parser.rb,
lib/castiel/elements/base_element.rb,
lib/castiel/elements/date_element.rb,
lib/castiel/elements/hour_element.rb,
lib/castiel/elements/symbol_element.rb,
lib/castiel/parsers/date_time_parser.rb

Defined Under Namespace

Modules: Elements, Parsers

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.default_parser_classObject



19
20
21
# File 'lib/castiel.rb', line 19

def self.default_parser_class
  @default_parser ||= Castiel::Parsers::DateTimeParser
end

.default_parser_class=(klass) ⇒ Object



23
24
25
26
# File 'lib/castiel.rb', line 23

def self.default_parser_class=(klass)
  raise 'Parser class must have a "parse" method declared' unless klass.instance_methods.include? :parse
  @default_parser = klass
end

.parse(elements) ⇒ Object



28
29
30
# File 'lib/castiel.rb', line 28

def self.parse(elements)
  default_parser_class.new.parse elements
end