Module: ForecastIo::Constants

Included in:
Lita::Handlers::OnewheelForecastIo
Defined in:
lib/lita/handlers/constants.rb

Instance Method Summary collapse

Instance Method Details

#ansi_charsObject



7
8
9
# File 'lib/lita/handlers/constants.rb', line 7

def ansi_chars
  %w[_     ]   # Thx, agj #pdxtech
end

#ascii_charsObject



15
16
17
# File 'lib/lita/handlers/constants.rb', line 15

def ascii_chars
  %w[_ . - ~ * ']
end

#colorsObject

IRC colors.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/lita/handlers/constants.rb', line 102

def colors
  { :white  => '00',
    :black  => '01',
    :blue   => '02',
    :green  => '03',
    :red    => '04',
    :brown  => '05',
    :purple => '06',
    :orange => '07',
    :yellow => '08',
    :lime   => '09',
    :teal   => '10',
    :aqua   => '11',
    :royal  => '12',
    :pink   => '13',
    :grey   => '14',
    :silver => '15'
  }
end

#get_humidity_range_colorsObject

Based on the percentage of relative humidity.



89
90
91
92
93
94
95
96
97
98
99
# File 'lib/lita/handlers/constants.rb', line 89

def get_humidity_range_colors
  {   0..0.12    => :blue,
      0.13..0.25 => :purple,
      0.26..0.38 => :teal,
      0.39..0.5  => :aqua,
      0.51..0.63 => :yellow,
      0.64..0.75 => :orange,
      0.76..0.88 => :red,
      0.89..1    => :pink,
  }
end

#get_rain_intensity_range_colorsObject

Based on the precipIntensity field, tested mostly on Portland data. YIMV.



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/lita/handlers/constants.rb', line 35

def get_rain_intensity_range_colors
  { 0..0.0050      => :blue,
    0.0051..0.0100 => :purple,
    0.0101..0.0130 => :teal,
    0.0131..0.0170 => :green,
    0.0171..0.0220 => :lime,
    0.0221..0.0280 => :aqua,
    0.0281..0.0330 => :yellow,
    0.0331..0.0380 => :orange,
    0.0381..0.0430 => :red,
    0.0431..5      => :pink
  }
end

#get_rain_range_colorsObject

Based on the chance of precipitation.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/lita/handlers/constants.rb', line 20

def get_rain_range_colors
  { 0..0.10    => :blue,
    0.11..0.20 => :purple,
    0.21..0.30 => :teal,
    0.31..0.40 => :green,
    0.41..0.50 => :lime,
    0.51..0.60 => :aqua,
    0.61..0.70 => :yellow,
    0.71..0.80 => :orange,
    0.81..0.90 => :red,
    0.91..1    => :pink
  }
end

#get_snowman(config) ⇒ Object

Just a shorthand function to return the configured snowflake.



123
124
125
126
127
128
# File 'lib/lita/handlers/constants.rb', line 123

def get_snowman(config)
  # '⛄'    # Fancy emoji snowman
  # '❄️'     # Fancy snowflake
  # '❄'     # Regular snowflake
  config.snowflake
end

#get_sun_range_colorsObject

Based on the chance of sun.



80
81
82
83
84
85
86
# File 'lib/lita/handlers/constants.rb', line 80

def get_sun_range_colors
  { 0..0.20    => :green,
    0.21..0.50 => :lime,
    0.51..0.70 => :orange,
    0.71..1    => :yellow
  }
end

#get_temp_range_colorsObject

Based on the temp in F.



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/lita/handlers/constants.rb', line 50

def get_temp_range_colors
  # Absolute zero?  You never know.
  { -459.7..24.99 => :blue,
    25..31.99     => :purple,
    32..38        => :teal,
    38..45        => :green,
    45..55        => :lime,
    55..65        => :aqua,
    65..75        => :yellow,
    75..85        => :orange,
    85..95        => :red,
    95..99.999    => :brown,
    100..159.3    => :pink
  }
end

#get_uvindex_colorsObject

I have no use for these yet, and yet they’re handy to know. def attributes

{ :bold       => 2.chr,
  :underlined => 31.chr,
  :underline  => 31.chr,
  :reversed   => 22.chr,
  :reverse    => 22.chr,
  :italic     => 22.chr,
  :reset      => 15.chr,
}

end



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/lita/handlers/constants.rb', line 142

def get_uvindex_colors
  { 0..0 => :black,
    1..1 => :royal,
    2..2 => :brown,
    3..3 => :purple,
    4..4 => :green,
    5..5 => :lime,
    6..6 => :red,
    7..7 => :orange,
    8..8 => :yellow,
    9..9 => :aqua,
    10..10 => :pink,
    11..11 => :white
  }
end

#get_wind_range_colorsObject

Based on the wind ground speed in mph.



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/lita/handlers/constants.rb', line 67

def get_wind_range_colors
  {   0..3    => :blue,
      3..6    => :purple,
      6..9    => :teal,
      9..12   => :aqua,
      12..15  => :yellow,
      15..18  => :orange,
      18..21  => :red,
      21..999 => :pink,
  }
end

#ozone_charsObject



11
12
13
# File 'lib/lita/handlers/constants.rb', line 11

def ozone_chars
  %w[ o O @  ]
end

#scaleObject



3
4
5
# File 'lib/lita/handlers/constants.rb', line 3

def scale
  'f'
end