summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-04-12 10:35:45 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-04-12 10:35:45 +0000
commitac39a3b330cbf7c4b65ba907783364b63fb109b3 (patch)
treee773d062644ecad55fcd0d48e505a882b0f94a82 /data
parentbf03d9f2b695772212abee81d405483c5c374633 (diff)
Module\#define_structure method: define a new Struct only if doesn't exist already or if the attribute list changed
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/bans.rb7
-rw-r--r--data/rbot/plugins/games/quiz.rb4
-rw-r--r--data/rbot/plugins/games/roulette.rb2
-rw-r--r--data/rbot/plugins/quotes.rb2
-rw-r--r--data/rbot/plugins/script.rb4
-rw-r--r--data/rbot/plugins/seen.rb2
-rw-r--r--data/rbot/plugins/url.rb2
7 files changed, 10 insertions, 13 deletions
diff --git a/data/rbot/plugins/bans.rb b/data/rbot/plugins/bans.rb
index 17281d4c..73121b7e 100644
--- a/data/rbot/plugins/bans.rb
+++ b/data/rbot/plugins/bans.rb
@@ -32,10 +32,9 @@
# * fixed regexp usage in requirements for plugin map
# * add proper auth management
-OnJoinAction = Struct.new("OnJoinAction", :host, :action, :channel, :reason)
-BadWordAction = Struct.new("BadWordAction", :regexp, :action, :channel, :timer, :reason)
-WhitelistEntry = Struct.new("WhitelistEntry", :host, :channel)
-
+define_structure :OnJoinAction, :host, :action, :channel, :reason
+define_structure :BadWordAction, :regexp, :action, :channel, :timer, :reason
+define_structure :WhitelistEntry, :host, :channel
class BansPlugin < Plugin
diff --git a/data/rbot/plugins/games/quiz.rb b/data/rbot/plugins/games/quiz.rb
index d73de90e..5f7392da 100644
--- a/data/rbot/plugins/games/quiz.rb
+++ b/data/rbot/plugins/games/quiz.rb
@@ -27,10 +27,10 @@
# TODO:: when Ruby 2.0 gets out, fix the FIXME 2.0 UTF-8 workarounds
# Class for storing question/answer pairs
-QuizBundle = Struct.new( "QuizBundle", :question, :answer )
+define_structure :QuizBundle, :question, :answer
# Class for storing player stats
-PlayerStats = Struct.new( "PlayerStats", :score, :jokers, :jokers_time )
+define_structure :PlayerStats, :score, :jokers, :jokers_time
# Why do we still need jokers_time? //Firetech
# Maximum number of jokers a player can gain
diff --git a/data/rbot/plugins/games/roulette.rb b/data/rbot/plugins/games/roulette.rb
index 5c9a86c6..0d2dc4c2 100644
--- a/data/rbot/plugins/games/roulette.rb
+++ b/data/rbot/plugins/games/roulette.rb
@@ -1,4 +1,4 @@
-RouletteHistory = Struct.new("RouletteHistory", :games, :shots, :deaths, :misses, :wins)
+define_structure :RouletteHistory, :games, :shots, :deaths, :misses, :wins
class RoulettePlugin < Plugin
BotConfig.register BotConfigBooleanValue.new('roulette.autospin',
diff --git a/data/rbot/plugins/quotes.rb b/data/rbot/plugins/quotes.rb
index 6851b65f..b5017a58 100644
--- a/data/rbot/plugins/quotes.rb
+++ b/data/rbot/plugins/quotes.rb
@@ -1,6 +1,6 @@
# GB: Ok, we *really* need to switch to db for this plugin too
-Quote = Struct.new("Quote", :num, :date, :source, :quote)
+define_structure :Quote, :num, :date, :source, :quote
class QuotePlugin < Plugin
def initialize
diff --git a/data/rbot/plugins/script.rb b/data/rbot/plugins/script.rb
index 29afa20a..38bb3134 100644
--- a/data/rbot/plugins/script.rb
+++ b/data/rbot/plugins/script.rb
@@ -13,9 +13,7 @@
# plugin. You can create them directly in an IRC channel, and invoke them just
# like normal rbot plugins.
-
-Command = Struct.new( "Command", :code, :nick, :created, :channel )
-
+define_structure :Command, :code, :nick, :created, :channel
class ScriptPlugin < Plugin
diff --git a/data/rbot/plugins/seen.rb b/data/rbot/plugins/seen.rb
index a697d19b..704b8324 100644
--- a/data/rbot/plugins/seen.rb
+++ b/data/rbot/plugins/seen.rb
@@ -1,4 +1,4 @@
-Saw = Struct.new("Saw", :nick, :time, :type, :where, :message)
+define_structure :Saw, :nick, :time, :type, :where, :message
class SeenPlugin < Plugin
def help(plugin, topic="")
diff --git a/data/rbot/plugins/url.rb b/data/rbot/plugins/url.rb
index 62fc5588..092ccbf9 100644
--- a/data/rbot/plugins/url.rb
+++ b/data/rbot/plugins/url.rb
@@ -1,4 +1,4 @@
-Url = Struct.new("Url", :channel, :nick, :time, :url, :info)
+define_structure :Url, :channel, :nick, :time, :url, :info
class ::UrlLinkError < RuntimeError
end