Permalink
Browse files

hm

  • Loading branch information...
1 parent 831c322 commit dec3335e9f43e118b747ba89e611982ab4b92dbd @hacxman hacxman committed Mar 11, 2012
Showing with 14 additions and 11 deletions.
  1. +13 −11 irc.rb
  2. +1 −0 usecase.rb
View
24 irc.rb
@@ -119,16 +119,17 @@ def _hear(re)
end
end
- def hear(re, &block)
+ def initialize()
@actions ||= []
+ end
+
+ def hear(re, &block)
@actions << [DSL::_hear(re), block]
puts "#{re} is an empty action" if not block
puts "#{re} has associated action"
p @actions
-
-# raise "Not implemented"
end
def bot_connected
@@ -146,30 +147,29 @@ def initialize
def server(s)
@cfg.server = s
- self
end
def port(p)
@cfg.port = p
- self
end
def name(n)
@cfg.name = n
- self
end
- def channels(sc, opts = {})
- opts[:scope] ||= nil
- @cfg.scope = sc
- self
+ def channels(ch, opts = {})
+ opts[:scope] ||= nil
+ @cfg.scope ||= {}
+ @cfg.scope[opts[:scope]] ||= []
+ @cfg.scope[opts[:scope]] += ch
end
end
def irc(&block)
@configs ||= []
i = Irc.new
- @configs << i.instance_eval(&block)
+ i.instance_eval(&block)
+ @configs << i
p @configs
end
@@ -192,4 +192,6 @@ def irc(&block)
puts "i can has block" if block
dsl = DSL.new
dsl.instance_eval &block
+ p dsl.instance_variable_get :@scopes
+ p dsl.instance_variable_get :@configs
end
View
@@ -30,6 +30,7 @@
bot_connected do
say "buzny"
+ set_topic "gejstvo | #{get_topic}"
end
user_connected do

0 comments on commit dec3335

Please sign in to comment.