class Widgets::Moon
Public Class Methods
Source
# File src/widgets/moon.rb, line 10 def initialize options options[:interval] ||= 3600 @astro = RubyBar::Astro.instance super @label = Gtk::Label.new '?🌚?' append @label init_timer end
Calls superclass method
Widgets::BaseWidget::new
Public Instance Methods
Source
# File src/widgets/moon.rb, line 19 def update @phase = case @astro.moon_phase when 0...0.0625, 0.9375..1.0 then '🌑' when 0.0625...0.1875 then '🌒' when 0.1875...0.3125 then '🌓' when 0.3125...0.4375 then '🌔' when 0.4375...0.5625 then '🌕' when 0.5625...0.6875 then '🌖' when 0.6875...0.8125 then '🌗' when 0.8125...0.9375 then '🌘' end @label.set_text instance_eval(&@proc) || @phase end