synoptic 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -1,3 +1,3 @@
1
1
  module Synoptic
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/synoptic.rb CHANGED
@@ -6,19 +6,18 @@ require "nokogiri"
6
6
  require "gtk2"
7
7
 
8
8
  module Synoptic
9
- public
10
- def on_timer
9
+ def self.on_timer
11
10
  $uri = URI.parse("http://www.spr.by/pogoda/kamenets-i-kamenetskiy-rayon/")
12
11
  http = Net::HTTP.new($uri.host)
13
12
  req = Net::HTTP::Get.new($uri.path)
14
13
  res = http.request(req)
15
14
 
16
15
  html = Nokogiri.HTML(res.body, nil, 'UTF-8')
17
- temp = html.css('span[style="font-size:44px;"]')[0].text
16
+ @temp = html.css('span[style="font-size:44px;"]')[0].text
18
17
  $status_icon.tooltip = "Температура в Каменце #{@temp}"
19
18
 
20
19
 
21
- tt = temp.partition(/\d{2}/)[1].to_i
20
+ tt = @temp.partition(/\d{2}/)[1].to_i
22
21
  if tt > 18
23
22
  $status_icon.pixbuf = $solnyshko
24
23
  else
@@ -28,8 +27,8 @@ public
28
27
 
29
28
  def self.start
30
29
  $status_icon = Gtk::StatusIcon.new()
31
- $solnyshko = Gdk::Pixbuf.new('/home/dzen/solnyshko.png')
32
- $sneg = Gdk::Pixbuf.new('/home/dzen/snejinka.png')
30
+ $solnyshko = Gdk::Pixbuf.new(File.dirname(__FILE__) + '/solnyshko.png')
31
+ $sneg = Gdk::Pixbuf.new(File.dirname(__FILE__) + '/snejinka.png')
33
32
  $status_icon.pixbuf = $solnyshko
34
33
  GLib::Timeout.add(5000) { on_timer }
35
34
  Gtk.main()
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synoptic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,14 +15,14 @@ description: Погода
15
15
  email:
16
16
  - chemt79@gmail.com
17
17
  executables:
18
- - synoptik
18
+ - synoptic
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
22
  - .gitignore
23
23
  - Gemfile
24
24
  - Rakefile
25
- - bin/synoptik
25
+ - bin/synoptic
26
26
  - lib/snejinka.png
27
27
  - lib/solnyshko.png
28
28
  - lib/synoptic.rb