Skip to content

Commit

Permalink
Finish porting to Crystal 0.18
Browse files Browse the repository at this point in the history
  • Loading branch information
jhass committed Jun 14, 2016
1 parent 49a4994 commit e3da7b8
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 20 deletions.
4 changes: 2 additions & 2 deletions bot/src/plugins/google.cr
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class Google
resp = HTTP::Client.get(
url,
HTTP::Headers {
"User-Agent": "Lynx/2.8.7rel.2 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/1.0.0a",
"Accept-Language": "en"
"User-Agent" => "Lynx/2.8.7rel.2 libwww-FM/2.14 SSL-MM/1.4.1 OpenSSL/1.0.0a",
"Accept-Language" => "en"
}
)

Expand Down
3 changes: 1 addition & 2 deletions framework/src/framework/bot.cr
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ module Framework
getter config
getter! connection : IRC::Connection
property! user : User
delegate channels, config
delegate logger, config
delegate channels, logger, to: config

def self.create
new.tap do |bot|
Expand Down
3 changes: 1 addition & 2 deletions framework/src/framework/configuration.cr
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ module Framework
end

property! name : String
delegate listens_to?, channels!
delegate wants?, channels!
delegate listens_to?, wants?, to: channels!

def channels!
@channels ||= ChannelList.default
Expand Down
3 changes: 1 addition & 2 deletions framework/src/framework/plugin_container.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ module Framework
include Workaround

getter config : C?
delegate channels, config
delegate wants?, config
delegate channels, wants?, to: config

def config
(@config ||= T.config_class.empty).tap do |config|
Expand Down
7 changes: 1 addition & 6 deletions framework/src/framework/user.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ require "./bot"

module Framework
record User, irc_user : IRC::User, context : Bot do
delegate mask, irc_user
delegate realname, irc_user
delegate nick, irc_user
delegate user, irc_user
delegate host, irc_user
delegate modes, irc_user
delegate mask, realname, nick, user, host, modes, to: irc_user

def self.from_nick(nick : String, context : Bot)
from_mask nick, context
Expand Down
2 changes: 1 addition & 1 deletion irc/src/irc/connection.cr
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module IRC
getter users
getter channels
getter network
delegate logger, config
delegate logger, to: config

@workers : {Processor, Reader, Sender}?

Expand Down
4 changes: 1 addition & 3 deletions irc/src/irc/user.cr
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ module IRC
getter channels
getter mask
getter modes
delegate nick, mask
delegate user, mask
delegate host, mask
delegate nick, user, host, to: mask

def initialize(@mask : Mask)
@authname = nil
Expand Down
4 changes: 2 additions & 2 deletions thread/src/thread/synchronized.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ class Synchronized(T)
@mutex = Mutex.new
end

macro method_missing(name, args, block)
macro method_missing(call)
@mutex.synchronize do
@target.{{name.id}}({{*args}}) {{block}}
@target.{{call}}
end
end
end

0 comments on commit e3da7b8

Please sign in to comment.