Module: NASA

Defined in:
lib/toychest/nasa.rb

Constant Summary collapse

@@N =
n.data
@@Zodiac =
@@Shower =
@@System =
Hash.new { |h,k| h[k] = [] }
@@Planet =
@@Moon =
@@Calendar =
{}

Class Method Summary collapse

Class Method Details

.[](q) ⇒ Object



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

def self.[] q
  h = {}
  r = Regexp.new(q)
  @@N.each_pair { |kk,vv|
    hh = {}
    vv.each { |e| 
      if r.match(e['name']) || r.match(e['description']); 
        hh[e['name']] = e['description'];
      end; 
    }.compact
    if hh.keys.length > 0
      h[kk] = hh
    end
  }
  return h
end

.calendarObject



44
45
46
# File 'lib/toychest/nasa.rb', line 44

def self.calendar
  @@Calendar
end

.categoriesObject



4
5
6
# File 'lib/toychest/nasa.rb', line 4

def self.categories
  @@N.keys
end

.categoryObject



7
8
9
# File 'lib/toychest/nasa.rb', line 7

def self.category
  @@N
end

.moonObject



59
60
61
# File 'lib/toychest/nasa.rb', line 59

def self.moon
  @@Moon
end

.planetObject



53
54
55
# File 'lib/toychest/nasa.rb', line 53

def self.planet
  @@Planet
end

.showerObject



56
57
58
# File 'lib/toychest/nasa.rb', line 56

def self.shower
  @@Shower
end

.systemObject



50
51
52
# File 'lib/toychest/nasa.rb', line 50

def self.system
  @@System
end

.yearObject



39
40
41
# File 'lib/toychest/nasa.rb', line 39

def self.year
  [ 'January', 'Feberuary', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ] 
end

.zodiacObject



47
48
49
# File 'lib/toychest/nasa.rb', line 47

def self.zodiac
  @@Zodiac
end