Closed simmel closed 8 years ago
You're not supposed to use Channel.new
. The correct alternative to the Channel()
helper would be ChannelList#find_ensured
, so e.g. bot.channel_list.find_ensured("#foo")
.
The attribute syncing relies on the multiton pattern. It assumes that for each channel, there is only exactly one instance. Whether or not that's a wart in Cinch's design can be argued, but that's the way it is.
This is probably a documentation issue.
On Mon, 2015-06-29 at 11:36:25 -0700, Dominik Honnef wrote:
You're not supposed to use
Channel.new
. The correct alternative to theChannel()
helper would beChannelList#find_ensured
, so e.g.bot.channel_list.find_ensured("#foo")
.
OIC, that works perfectly! I'm guessing that User.new vs. bot.user_list.find_ensured("nick") works the same way?
The attribute syncing relies on the multiton pattern. It assumes that for each channel, there is only exactly one instance.
Can't you make classes or initialization method private (not that it matters much in Ruby but hey. Atleast it's some kind of indication that you shouldn't use them).
This is probably a documentation issue.
Agreed. Any idea where to document it? Common {tasks,mistakes}? I can take a stab at a documentation PR if you'd like?
Yes, the same applies to users. Making new
private wouldn't really work; then nobody could create the required instances (without resorting to send
).
The best place to document this are probably the docstrings for User#initialize
and Channel#initialize
, as well as the documentation for the classes themselves.
How's that? I didn't quite understand what you meant by "as well as the documentation for the classes themselves" though, please elaborate.
How do you generate the docs? rdoc didn't get all the tags correct so I haven't really checked if it works.
This is what I meant:
# This is the documentation of Channel.
class Channel
# This is the documentation of #initialize.
def initialize; end
end
The documentation is generated by YARD
How does that look?
Trying to use Cinch from Lita but I can reproduce it by using a modified version of the example:
here it's connected to ngircd but I get the same problem when connecting to freenode.