Class: Raph::Raph

Inherits:
Object
  • Object
show all
Defined in:
lib/raph.rb

Overview

TODO: class description

Instance Method Summary collapse

Constructor Details

#initializeRaph

Returns a new instance of Raph.



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

def initialize
  @parsed = {}
  @parsers = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *arguments, &block) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/raph.rb', line 29

def method_missing(method_sym, *arguments, &block)
  # TODO: do not accept any arguments or block

  if has_attribute? method_sym
    get_attribute_value method_sym
  else
    super
  end
end

Instance Method Details

#add_parser(parser) ⇒ Object



25
26
27
# File 'lib/raph.rb', line 25

def add_parser(parser)
  @parsers.push parser
end

#allObject



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

def all
  @all.dup
end

#parse(args) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/raph.rb', line 13

def parse(args)
  @all = args.dup

  @parsers.each do |p|
    @parsed[p.id.to_sym] = p.parse(@all)
  end
end