dyndyndong 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -70,44 +70,49 @@ class Generic < Service
70
70
  when 'msgtable'
71
71
  raise ArgumentError, "wrong number of arguments (#{args.size} for 1)" if args.size != 1
72
72
  raise ArgumentError, "wrong type" if !args.first.is_a?(Hash)
73
- self.class_eval %Q{
74
- def MSGTABLE(x)
75
- #{args.first.inspect}[x]
73
+
74
+ self.class_eval {
75
+ define_method 'MSGTABLE' do |x|
76
+ args.first[x]
76
77
  end
77
78
  }
78
79
  when 'update_host'
79
80
  raise ArgumentError, "wrong number of arguments (#{args.size} for 1)" if args.size != 1
80
81
  raise ArgumentError, "wrong type" if !args.first.is_a?(String)
81
- self.class_eval %Q{
82
- def update_host
83
- #{args.first.inspect}
82
+
83
+ self.class_eval {
84
+ define_method 'update_host' do
85
+ args.first
84
86
  end
85
87
  }
86
88
  when 'offline'
87
89
  raise ArgumentError, "wrong number of arguments (#{args.size} for 2)" if args.size != 2
88
90
  raise ArgumentError, "wrong type" if !args[0].is_a?(String) or !args[1].is_a?(String)
89
- self.class_eval %Q{
90
- def offlines(what)
91
+
92
+ self.class_eval {
93
+ define_method 'offlines' do
91
94
  {
92
- 'YES' => #{args[0].inspect},
93
- 'NO' => #{args[1].inspect}
94
- }[what]
95
+ 'YES' => args[0],
96
+ 'NO' => args[1]
97
+ }
95
98
  end
96
99
  }
100
+ else
101
+ raise ArgumentError, "Cannot set #{sym}"
97
102
  end
98
103
  end
99
104
 
100
105
  private
101
106
 
102
- def offlines(what)
107
+ def offlines
103
108
  {
104
109
  'YES' => 'YES',
105
110
  'NO' => 'NO'
106
- }[what]
111
+ }
107
112
  end
108
113
 
109
114
  def offline?(offline)
110
- offline ? offlines('YES') : offlines('NO')
115
+ offline ? offlines['YES'] : offlines['NO']
111
116
  end
112
117
 
113
118
  def getip(h = nil)
@@ -19,6 +19,6 @@
19
19
 
20
20
  module DynDynDong
21
21
 
22
- VERSION = '0.0.3'
22
+ VERSION = '0.0.4'
23
23
 
24
24
  end
data/lib/dyndyndong.rb CHANGED
@@ -16,6 +16,6 @@
16
16
  # You should have received a copy of the GNU Affero General Public License
17
17
  # along with dyndyndong. If not, see <http://www.gnu.org/licenses/>.
18
18
  #++
19
-
19
+ $DEBUG = true
20
20
  require 'dyndyndong/client'
21
21
  require 'dyndyndong/daemon'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - shura
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-15 00:00:00 +01:00
17
+ date: 2010-12-16 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency