Class: Wikiwhat::Results

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

Direct Known Subclasses

Media, Text

Instance Method Summary collapse

Constructor Details

#initializeResults

Returns a new instance of Results.



6
7
8
# File 'lib/wikiwhat/parse.rb', line 6

def initialize
  @result = nil
end

Instance Method Details

#pull_from_hash(hash, key) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/wikiwhat/parse.rb', line 10

def pull_from_hash(hash, key)
  @hash = hash
  @key = key

  if @hash.include?(@key)
    @result = @hash[@key]
  else
    @hash.each_pair do |k, v|
      if v.class == Hash
        pull_from_hash(v, @key)
      end
    end
  end
  @result
end