pastorinni has quit [Remote host closed the connection]
John___ has quit [Read error: Connection reset by peer]
l_tonz has joined #ruby
bronson has quit [Ping timeout: 248 seconds]
l_tonz has quit [Ping timeout: 248 seconds]
r4z3r has joined #ruby
bmurt has joined #ruby
ResidentBiscuit has joined #ruby
orbyt_ has joined #ruby
l_tonz has joined #ruby
jamiejackson has quit [Ping timeout: 276 seconds]
ta_ has quit [Remote host closed the connection]
Algebr has joined #ruby
<troydm>
I might be dumb, but I open3 a cat command and trying to feed stdin to it but I keep weird behaviour with stderr, because it blocks read_nonblock
<Algebr>
anyone here going to the ruby thing tonight in SF?
<Algebr>
havenwood: going to SF thing?
<havenwood>
Algebr: I'm in LA at the moment
<havenwood>
Algebr: Otherwise I would be!
<Algebr>
ah
k0mpa has quit [Remote host closed the connection]
cdg_ has quit [Ping timeout: 256 seconds]
vhvv has joined #ruby
vhvv has quit [Client Quit]
l_tonz has quit [Ping timeout: 276 seconds]
Zamyatin has joined #ruby
guacamole has joined #ruby
quobo has quit [Quit: Connection closed for inactivity]
guacamole has quit [Client Quit]
s3nd1v0g1us has joined #ruby
ResidentBiscuit is now known as jready
SeepingN has quit [Quit: The system is going down for reboot NOW!]
guacamole has joined #ruby
jeffreylevesque has quit [Remote host closed the connection]
eckhardt has joined #ruby
jeffreylevesque has joined #ruby
hahuang65 has quit [Ping timeout: 248 seconds]
guacamole has quit [Client Quit]
cdg has joined #ruby
Algebr has quit [Remote host closed the connection]
Azure has quit [Read error: Connection reset by peer]
Azure|dc has joined #ruby
hahuang65 has joined #ruby
cdg has quit [Ping timeout: 276 seconds]
drewmcmillan has joined #ruby
ta_ has joined #ruby
alfiemax has joined #ruby
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
l_tonz has quit [Remote host closed the connection]
KeyJoo has quit [Ping timeout: 260 seconds]
KeyJoo has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has quit [Remote host closed the connection]
jtdoncas has joined #ruby
aupadhye has joined #ruby
aupadhye is now known as aupadhye|meeting
aupadhye|meeting is now known as aupadhye
za1b1tsu has joined #ruby
ta_ has quit [Ping timeout: 256 seconds]
hahuang65 has joined #ruby
zapata_ is now known as zapata
hahuang65 has quit [Ping timeout: 268 seconds]
ta_ has joined #ruby
megamosaren has quit [Ping timeout: 268 seconds]
dionysus69 has joined #ruby
Puffball has quit [Read error: Connection reset by peer]
l_tonz has joined #ruby
apeiros has quit [Remote host closed the connection]
dionysus69 has quit [Ping timeout: 260 seconds]
brianpWins has quit [Quit: brianpWins]
elphe has quit [Ping timeout: 268 seconds]
iamarun has quit [Ping timeout: 256 seconds]
iamarun has joined #ruby
oetjenj has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
oetjenj has joined #ruby
jenrzzz has joined #ruby
oetjenj has quit [Client Quit]
ur5us has joined #ruby
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
troys is now known as troys_
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
jamesaxl has joined #ruby
oetjenj has quit [Client Quit]
oetjenj has joined #ruby
oetjenj has quit [Client Quit]
quobo has joined #ruby
oetjenj has joined #ruby
darkhanb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
oetjenj has quit [Client Quit]
troys_ is now known as troys
LocaMocha has joined #ruby
dinfuehr has quit [Ping timeout: 255 seconds]
dinfuehr has joined #ruby
elphe has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
rabajaj has joined #ruby
anisha has joined #ruby
ta_ has quit [Ping timeout: 276 seconds]
oleo has quit [Quit: Leaving]
ta_ has joined #ruby
elphe has quit [Ping timeout: 264 seconds]
alfiemax has quit [Remote host closed the connection]
apeiros has joined #ruby
mikhael_k33hl has joined #ruby
<mikhael_k33hl>
Tried running rubocop on my rb file to check. I'm getting this Missing top-level module documentation comment. module FileOps warning. What does this mean?
<apeiros>
mikhael_k33hl: I assume it means that you didn't document that module
elphe has joined #ruby
<mikhael_k33hl>
apeiros: Uhhhm how do I document it? using comments?
Asher has quit [Quit: Leaving.]
<apeiros>
yes. see rdoc or yard.
<mikhael_k33hl>
apeiros: okay I'll take a look at it
<mikhael_k33hl>
thanks
alfiemax has joined #ruby
megamosaren has joined #ruby
Asher has joined #ruby
darkhanb has joined #ruby
npgm has quit [Quit: Connection closed for inactivity]
darkhanb has quit [Client Quit]
megamosaren has quit [Ping timeout: 276 seconds]
drewmcmillan has joined #ruby
drewmcmillan has quit [Client Quit]
bronson has joined #ruby
jamesaxl has quit [Read error: Connection reset by peer]
jamesaxl has joined #ruby
dionysus69 has joined #ruby
phaul has joined #ruby
jtdoncas has quit [Ping timeout: 248 seconds]
darkhanb has joined #ruby
Puffball has joined #ruby
bronson has quit [Ping timeout: 260 seconds]
sundhell_away is now known as sundhell
zwliew has quit [Quit: Connection closed for inactivity]
ramfjord has joined #ruby
Asher has quit [Quit: Leaving.]
ramfjord has quit [Ping timeout: 248 seconds]
za1b1tsu has quit [Remote host closed the connection]
Asher has joined #ruby
LenPayne has quit [Ping timeout: 268 seconds]
sundhell is now known as sundhell_away
LenPayne has joined #ruby
roshanavand has joined #ruby
sundhell_away is now known as sundhell
jtdoncas has joined #ruby
zwliew has joined #ruby
troys has quit [Quit: Bye]
<mikhael_k33hl>
Regarding Logging, can someone refer me to an article pertaining ruby's best practice about it? or are you guys using a gem?
jtdoncas has quit [Ping timeout: 248 seconds]
<apeiros>
mikhael_k33hl: logger is part of stdlib
<apeiros>
best practices depend highly on your use-case
<apeiros>
f.ex. part of 12factor apps is to not log to files at all
<apeiros>
in a server application which runs in multiple processes and threads, you should make PID and Thread-ID part of what you emit (rails terribly fails at that)
<mikhael_k33hl>
apeiros: so just output it on standard output?
<apeiros>
mikhael_k33hl: again, depends on your use-case.
<apeiros>
as with most things in programming, there's no silver bullet. no one true answer.
<mikhael_k33hl>
apeiros: Hmm so it would be best to create the Log Object on a module and just include it on every class that I need logging capabilities right?
<mikhael_k33hl>
oh or just create a global variable
ta_ has quit [Ping timeout: 248 seconds]
<apeiros>
I prefer constants over globals
hahuang65 has joined #ruby
Dimik has quit [Ping timeout: 264 seconds]
jtdoncas has quit [Ping timeout: 248 seconds]
<apeiros>
and I'd probably prefer a class method over a constant to access the logger
<apeiros>
e.g. YourApp.logger
andikr has joined #ruby
madhatter has quit [Quit: Lost terminal]
<dminuoso>
apeiros: constants _are_ globals.
conta has joined #ruby
<dminuoso>
The only difference is that $ gvars dont have namespacing, so I guess that makes constants a little more organizeable.
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hahuang65 has quit [Ping timeout: 240 seconds]
jameser has joined #ruby
<dminuoso>
Though I guess there's that bit about private_constant, but oh well - out of all the gems I have installed, only concurrent-ruby actually makes use of it.
ta_ has joined #ruby
iamarun has quit [Remote host closed the connection]
<apeiros>
dminuoso: no, they are globally visible. they are not globals. yes, the distinction matters.
iamarun has joined #ruby
<apeiros>
and correct, the namespacing is the relevant feature. Foo != Foo depending on your Module.nesting
<apeiros>
whereas $foo is always == $foo
<dminuoso>
apeiros: what exactly is the difference between a globally visible variable and a global variable then?
<apeiros>
(meaning the variable, not the ref'd obj)
<apeiros>
^
<dminuoso>
apeiros: That's just language ergonomics. private_constant aside, constants are global variables. Foo == Foo always. The thing is, just imagine you never used relative constant names, but always fully qualify them.
<dminuoso>
Say ::Foo::Bar::Quux
<apeiros>
in short: the difference is that the name alone is not identifying the constant.
<dminuoso>
apeiros: It absolutely is.
<apeiros>
if you fully qualify it, yes
<apeiros>
if not, context is part of the identification.
<apeiros>
same as other variables.
<apeiros>
by your logic, any globally reachable variable is a global.
<dminuoso>
Yes.
<dminuoso>
Precisely.
<dminuoso>
That is the very definition of a global variable.
<apeiros>
then the distinction doesn't matter and why do we use terminology anyway? :-p
<apeiros>
I can reach ivars globally too
<apeiros>
if I have enough identifying information
kapil___ has quit [Quit: Connection closed for inactivity]
<dminuoso>
You dont need identifying information.
<apeiros>
and "enough identifying information" = "stuff beyond the bare name"
<dminuoso>
And realistically yes.
<dminuoso>
Because you have ObjectSpace.
<apeiros>
and "fully qualified" = "stuff beyond the bare name"
<apeiros>
so sorry, but IMO your reason is pointless.
<apeiros>
ObjectSpace requires identifying information too
<apeiros>
e.g. an object id for _id2ref
* apeiros
shall henceforth call an @ivar an @diminuoso_global ;-p
<apeiros>
-i
<apeiros>
no tabcomplete with @ :<
elphe has quit [Ping timeout: 276 seconds]
l_tonz has quit [Remote host closed the connection]
Chuguniy has joined #ruby
TomyWork has joined #ruby
elphe has joined #ruby
mark_66 has joined #ruby
madhatter has joined #ruby
ta_ has quit [Ping timeout: 264 seconds]
elphe has quit [Ping timeout: 265 seconds]
elphe has joined #ruby
ta_ has joined #ruby
jtdoncas has joined #ruby
drewmcmillan has joined #ruby
jtdoncas has quit [Ping timeout: 255 seconds]
QualityAddict has quit [Ping timeout: 264 seconds]
iamarun has quit [Ping timeout: 268 seconds]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Burgestrand has joined #ruby
elphe has quit [Ping timeout: 248 seconds]
jameser has joined #ruby
quobo has quit [Quit: Connection closed for inactivity]
andikr has quit [Remote host closed the connection]
anisha has quit [Quit: Leaving]
cdg has quit [Remote host closed the connection]
cdg has joined #ruby
l_tonz has joined #ruby
Psybur_ has joined #ruby
elphe has joined #ruby
ua has quit [Ping timeout: 248 seconds]
Psybur has quit [Ping timeout: 268 seconds]
l_tonz has quit [Ping timeout: 255 seconds]
Troy2 has quit [Ping timeout: 268 seconds]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
kapil___ has joined #ruby
bmurt has quit [Ping timeout: 268 seconds]
ua has joined #ruby
jeffreylevesque has joined #ruby
apeiros has quit [Remote host closed the connection]
terens has joined #ruby
<terens>
Is there a way to override a private module ?
n0m4d1c_ has quit [Remote host closed the connection]
<dminuoso>
terens: What private what?
amatas_ has joined #ruby
<terens>
class AClass .... private .... module XXX ... end end
<terens>
to extend/change XXX module from outside
<dminuoso>
terens: That doesn't do what you think it does.
<dminuoso>
terens: `private` changes method visibility. A module has no notion of being "private"
<dminuoso>
terens: There are however private constants.
alfiemax has quit [Ping timeout: 268 seconds]
<terens>
having private visibility
<terens>
is there a way to alter its code?
<terens>
i mean if the code above is at a gem
<terens>
and I want to change it
alfiemax has joined #ruby
<dminuoso>
terens: Then fork the code.
<terens>
change a method inside that module
<terens>
maybe that is what I am going to do
<dminuoso>
terens: If you intend to change how somebody elses code behaves, then change that code.
<dminuoso>
:-)
jottr has joined #ruby
tomphp has joined #ruby
jtdoncas has joined #ruby
bonhag has joined #ruby
kyle__ has quit [Remote host closed the connection]
daed has quit [Remote host closed the connection]
immune has quit [Ping timeout: 240 seconds]
amatas_ has quit [Quit: amatas_]
milardovich has joined #ruby
megamosaren has quit [Ping timeout: 240 seconds]
vondruch has quit [Quit: vondruch]
vondruch has joined #ruby
amatas_ has joined #ruby
Guest37798 has joined #ruby
tomphp has quit [Client Quit]
Guest37798 is now known as kyle__
jtdoncas has quit [Ping timeout: 252 seconds]
milardovich has quit [Remote host closed the connection]
terens has quit [Ping timeout: 276 seconds]
<Burgestrand>
terens Yes, ruby allows you to override defined methods, and replace constants
terens has joined #ruby
<Burgestrand>
terens Typically frowned upon, because changing code that's not yours means it might change from underneath you without you knowing
l_tonz has joined #ruby
<Burgestrand>
Noticed you left the channel, so my previous message said: terens Yes, ruby allows you to override defined methods, and replace constants
<dminuoso>
Burgestrand: And how do you access a module behind a private constant?
ramfjord has joined #ruby
<dminuoso>
(For the purpose of this discussion you are forbidden to use ObjectSpace or Fidddle)
<Burgestrand>
dminuoso Where does it say it's a private constant?
<dminuoso>
Burgestrand: It was kind of implied.
<Burgestrand>
dminuoso Not to me
<dminuoso>
Burgestrand: Fair enough/
milardovich has joined #ruby
immune has joined #ruby
terens has quit [Ping timeout: 268 seconds]
apparition has quit [Quit: Bye]
ramfjord has quit [Ping timeout: 264 seconds]
milardovich has quit [Client Quit]
<Burgestrand>
dminuoso Turns out `const_get` doesn't care about constant visibility :)
cdg has quit [Read error: Connection reset by peer]
cdg has joined #ruby
cdg_ has joined #ruby
jamiejackson has quit [Ping timeout: 276 seconds]
VladGh has quit [Quit: Lost terminal]
bonhag has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mark_66 has quit [Remote host closed the connection]
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
VladGh has joined #ruby
ta_ has quit [Remote host closed the connection]
bonhag has joined #ruby
im0nde has joined #ruby
dionysus69 has joined #ruby
ta_ has joined #ruby
cdg has quit [Ping timeout: 248 seconds]
bonhag has quit [Remote host closed the connection]
dionysus69 has quit [Client Quit]
l_tonz has quit [Ping timeout: 268 seconds]
ta_ has quit [Ping timeout: 248 seconds]
LenPayne has quit [Ping timeout: 240 seconds]
conta has quit [Ping timeout: 276 seconds]
jtdoncas has joined #ruby
gizmore|2 has joined #ruby
gizmore has quit [Ping timeout: 260 seconds]
hays_ has joined #ruby
hays_ has joined #ruby
vichib has joined #ruby
vichib has quit [Max SendQ exceeded]
LenPayne has joined #ruby
vichib has joined #ruby
<hays_>
hey can someone help me with a pattern? I want to have a class where I define an error handler, e.g. onError { |e| ... } and then I call that error handler whenever I feel like I need do with argument e
<hays_>
not sure how to set all of this up... an example would be awesome
jtdoncas has quit [Ping timeout: 256 seconds]
apeiros has joined #ruby
n0m4d1c has joined #ruby
immune has quit [Ping timeout: 264 seconds]
<ule>
hays_: I guess you can create a custom excemption, and then every time you feel like you can raise that exception
<canton7>
but yeah, consider whether throwing an exception is more appropriate
<hays_>
I will consider. thanks for the same.
<hays_>
sample
uZiel has joined #ruby
apeiros has quit [Ping timeout: 264 seconds]
<hays_>
as is usually the case, I have a few things going on here, so .. my design may not be perfect :)
vichib has quit [Remote host closed the connection]
Puffball has quit [Remote host closed the connection]
drewmcmillan has joined #ruby
<hays_>
I was thinking I'd need yields to make this happen
vichib has joined #ruby
alfiemax_ has joined #ruby
vichib has quit [Remote host closed the connection]
<hays_>
canton7: can you explain the .(e) ? what are the parens for?
synthroid has quit [Remote host closed the connection]
alfiemax has quit [Ping timeout: 248 seconds]
immune has joined #ruby
vichib has joined #ruby
<canton7>
that's shorthand for Proc#call. You could also do @error_handler.call(e)
alfiemax has joined #ruby
GremL1N2 has quit [Ping timeout: 248 seconds]
alfiemax_ has quit [Ping timeout: 268 seconds]
axsuul has quit [Ping timeout: 248 seconds]
kapil___ has quit [Quit: Connection closed for inactivity]
axsuul has joined #ruby
randomstrangerb has quit [Ping timeout: 248 seconds]
randomstrangerb has joined #ruby
<hays_>
what is the shortest way to create an Exception class? I want to do it at the begginning of my class definition and its just derived from standarderror. Do I need two lines to do this?
<hays_>
RIght now all I am using this for is to give the exception a different name, so that I can identify it as a unique error
<hays_>
class Foo < StandardException / end is the shortest I've found today, but I could have sworn there was a one-liner
<canton7>
class Foo < StandardException; end
synthroid has joined #ruby
[Butch] has joined #ruby
nadir has joined #ruby
AndroUser2 has quit [Remote host closed the connection]
<hays_>
I think this is what I'd seen: FailedReset = Class.new(NoMethodError)
<hays_>
is that just different syntax for the same thing?
alfiemax has quit [Remote host closed the connection]
<leah2>
is there a ruby ORM library which maps to plain old ruby objects (i.e. doensn't make them inherit some active record thingy), i'm thinking of something like Yesod.Persistent
l_tonz has joined #ruby
ta_ has joined #ruby
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<canton7>
yes, and there's DataMapper (you need an include though), but I'm not sure if that's still in fashion
<leah2>
last release 2011, hmm :P
jtdoncas has joined #ruby
AndroUser2 has joined #ruby
l_tonz has quit [Ping timeout: 264 seconds]
<leah2>
i guess everone not using AR uses sequel now
<canton7>
shows how long it's been since I last did databasey stuff in Ruby :P
aufi has quit [Quit: Leaving]
<canton7>
aah I forgot about Sequel, yes
<leah2>
hm, there is ROM too
cdg has joined #ruby
l_tonz has joined #ruby
cdg__ has joined #ruby
jtdoncas has quit [Ping timeout: 264 seconds]
drewmcmillan has joined #ruby
cdg has quit [Read error: Connection reset by peer]
cdg_ has quit [Ping timeout: 248 seconds]
uZiel has quit [Remote host closed the connection]
d^sh has joined #ruby
troys has joined #ruby
immune has quit [Ping timeout: 248 seconds]
d^sh- has quit [Ping timeout: 276 seconds]
phaul has joined #ruby
sanscoeur has joined #ruby
vichib has quit [Remote host closed the connection]
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Pgouv_ has quit [Ping timeout: 260 seconds]
Sembei has quit [Quit: WeeChat 2.1-dev]
guacamole has joined #ruby
dviola has quit [Quit: WeeChat 2.0.1]
Sembei has joined #ruby
bronson has joined #ruby
guacamole has quit [Client Quit]
l_tonz has joined #ruby
guacamole has joined #ruby
bronson has quit [Ping timeout: 276 seconds]
jenrzzz_ has joined #ruby
spiette has quit [Quit: :qa!]
weathermaker has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
<yeoman>
thing that always bugged me
<yeoman>
how do i read all from a socket that is there
<yeoman>
if i do IO.select([socket])
<yeoman>
i know i can read from that socket
<yeoman>
but if i do socket.read
<yeoman>
it blocks.. until? i don't know..
l_tonz has quit [Ping timeout: 276 seconds]
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<eam>
yeoman: if select returns saying it's readable then #sysread will not block
guacamole has joined #ruby
<eam>
don't use #read or #write if you want to be particular about your i/o, as they may do i/o you don't want (or, may not do i/o that you do want) because of the buffering
weathermaker has quit [Quit: weathermaker]
weathermaker has joined #ruby
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
guacamole has quit [Client Quit]
prutheus has joined #ruby
ta_ has quit [Remote host closed the connection]
<prutheus>
Hello. I need to parse a difficult string: "Building: ?????? ??????? ???? ??????Address: محيط الظريفRemark: \nمستودع للايجار محيط الظريف مساحة 300متر مع نزلة كميون ايجار شهري 1500$ للاستعلام 03124927 \\ 71127376" Need to parse the parameters Building, Address, Remark etc. Difficulty: String is not always same. Maybe Building is missing, but some Parameters more
ta_ has joined #ruby
<prutheus>
And the parameters are directly without space behind one other, so how to split?
<cjohnson>
prutheus: That sure sounds like a shitty format lol
<cjohnson>
How did you end up with that?
jtdoncas has joined #ruby
<cjohnson>
Assuming there is no end-of-value boundary, you can try using a start-of-value boundary to find the end
n0m4d1c has quit [Remote host closed the connection]
<cjohnson>
So for example, come up with a list of parameters, and for each one, find Parameter:.*(?!Other|Parameters|Here)
the_f0ster has joined #ruby
<cjohnson>
And run that regexp once per parameter
<cjohnson>
I wouldn't just split on : since the value might contain :
inoperable__ has joined #ruby
<the_f0ster>
how I can access an instance or class variable from a module that is being extended ?
<baweaver>
Now give me a JSON list of Composer => tabs
inoperable__ has joined #ruby
DEac- has quit [Ping timeout: 255 seconds]
<baweaver>
such that {'Zequinha de Abreu' => ['Tico Tico']} and etc
goatish has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<baweaver>
(mind I've already written aforementioned code, just haven't put it on git yet)
<baweaver>
the fun is that it's not semantic html and there's no real nesting
inoperable__ has quit [Client Quit]
<baweaver>
if you really want a challenge, get the meta information like LHF, MIDIs, Videos, and links as well :D
synthroid has quit []
<baweaver>
cjohnson: that's how you give Nokogiri one heck of a workout
matchaw has joined #ruby
the_f0ster has quit [Read error: Connection reset by peer]
<baweaver>
havenwood: if you want a hard one ^
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
drewmcmillan has joined #ruby
guacamole has joined #ruby
alfiemax has quit [Remote host closed the connection]
plexigras has quit [Ping timeout: 256 seconds]
jeffreylevesque has quit [Ping timeout: 248 seconds]
<baweaver>
Also an easier one-liner challenge: Take a string like 'aaaaaabbbcccccddd' and compact it to 'a6b3c5d3'
troys is now known as troys_
<cjohnson>
def foo(input) 'a6b3c5d3' end
<cjohnson>
foo('aaaaaabbbcccccddd')
<cjohnson>
boom
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
* cjohnson
mic drop
plexigras has joined #ruby
guacamole has quit [Client Quit]
elphe has joined #ruby
cdg has joined #ruby
jtdoncas has joined #ruby
marr has joined #ruby
guacamole has joined #ruby
jenrzzz_ has quit [Ping timeout: 248 seconds]
DEac- has joined #ruby
plexigras has quit [Ping timeout: 276 seconds]
* baweaver
claps
elphe has quit [Ping timeout: 276 seconds]
guacamole has quit [Client Quit]
jtdoncas has quit [Ping timeout: 240 seconds]
weaksauc_ has joined #ruby
weaksauce has quit [Read error: Connection reset by peer]
guacamole has joined #ruby
alfiemax has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
<baweaver>
>> 'aaaaaabbbcccccddd'.chars.slice_when{|a,b|a!=b}.reduce(''){|s,a|s+a[0]+a.size.to_s} # Not fond of it though
<ruby[bot]>
baweaver: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
plexigras has joined #ruby
chocoelho has joined #ruby
<baweaver>
works in my REPL at least.
<baweaver>
odd
jamesaxl has quit [Quit: WeeChat 1.9.1]
alfiemax has quit [Ping timeout: 264 seconds]
cloaked1 has quit [Quit: Leaving]
guacamole has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bmurt has joined #ruby
jenrzzz has quit [Ping timeout: 240 seconds]
chocoelho has quit [Quit: chocoelho]
guacamole has joined #ruby
LenPayne has quit [Ping timeout: 240 seconds]
LenPayne has joined #ruby
guacamole has quit [Client Quit]
tomphp has joined #ruby
amatas has quit [Quit: amatas]
bmurt has quit [Ping timeout: 276 seconds]
mtkd has quit [Ping timeout: 265 seconds]
guacamole has joined #ruby
bmurt has joined #ruby
ta_ has quit [Remote host closed the connection]
mtkd has joined #ruby
jenrzzz has joined #ruby
ta_ has joined #ruby
plexigras has quit [Remote host closed the connection]
drewmcmillan has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ta_ has quit [Remote host closed the connection]
guacamole has quit [Client Quit]
ta_ has joined #ruby
ta_ has quit [Remote host closed the connection]
alex`` has quit [Ping timeout: 265 seconds]
ta_ has joined #ruby
ta_ has quit [Remote host closed the connection]
plexigras has joined #ruby
ta_ has joined #ruby
ta_ has quit [Remote host closed the connection]
guacamole has joined #ruby
LenPayne has quit [Ping timeout: 256 seconds]
PaulCapestany has quit [Quit: .]
LenPayne has joined #ruby
PaulCapestany has joined #ruby
plexi has joined #ruby
guacamole has quit [Ping timeout: 248 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
tectonic has joined #ruby
plexigras has quit [Ping timeout: 276 seconds]
hello_world has joined #ruby
hello_world has quit [Client Quit]
randomstrangerb has quit [Ping timeout: 240 seconds]
mikecmpbll has joined #ruby
clemens3 has quit [Ping timeout: 265 seconds]
drewmcmillan has joined #ruby
g105b has joined #ruby
alfiemax has joined #ruby
<g105b>
Hi I'm trying to run gem install sass and I get this error: The last version of ffi (< 2, >= 0.5.0) to support your Ruby & RubyGems was 1.9.18. I'm running Windows 10 Pro, followed instructions on http://sass-lang.com/install "The fastest way to get Ruby on your Windows computer is to use Ruby Installer (http://rubyinstaller.org/)"
<g105b>
Oh I see RubyInstaller has back-dated versions. Thanks.
plexi has quit [Read error: No route to host]
alfiemax has quit [Ping timeout: 264 seconds]
<havenwood>
g105b: If you install WSL then you can just follow Ubuntu instructions.
benjen has joined #ruby
plexi has joined #ruby
<g105b>
havenwood: The reason I'm here is because I'm very familiar with Linux over Windows, and turned to WSL as my security blanked, but unfortunately it isn't fit for real world use yet.
<havenwood>
(In bash instead of PowerShell.)
<havenwood>
g105b: I'm afraid Windows is no more fit for real world use. ;-P
<havenwood>
g105b: gotcha
<g105b>
I think you might be right, but somehow people insist on using it !
clemens3 has joined #ruby
<g105b>
WSL is a lie.
<havenwood>
I got as far as Postgres, then it borked.
<havenwood>
We were trying to update the RailsGirls curriculum for Windows and it would *really* be nice for WSL to actually work,
<havenwood>
They may have fixed that issue? Unuse.
<g105b>
I had to start supporting Windows, so I have forced myself to use it. WSL sounded superb, and so did Docker, but unfortunately neither are a solution just yet.
<havenwood>
mmm
<bawNg>
on the off chance that anyone here ever needs to reduce the overhead of calling a proc from a C extension, I got it down to around 1us by digging through the internals and using rb_vm_invoke_proc directly
<g105b>
Sorry bawNg but that's too fast for me.
plexi has quit [Ping timeout: 276 seconds]
<havenwood>
bawNg: Good question. It might be worth posing the question on the mailing list as well.
<havenwood>
Err, I guess not a question now. You've solved it!
<havenwood>
bawNg: Neat!
jenrzzz has quit [Ping timeout: 256 seconds]
dave_den has quit [Quit: Leaving.]
<bawNg>
I'm prototyping a scheduler which needs to be able to fire timer callbacks as accurately as possible, getting the calling overhead down to about 1us allows the reactor thread to wake up and fire the timer with more precision than sleeping in a native ruby thread
Ltem has joined #ruby
<g105b>
havenwood: Thanks for your help, I'm up and running as I need to :)
DEac- has joined #ruby
immune has quit [Ping timeout: 265 seconds]
Ltem has quit [Client Quit]
conceivably has joined #ruby
pastorinni has quit [Remote host closed the connection]
<conceivably>
Hello, I'm writing a Ruby class that will only have one public method 'run'. How do I decide what belongs into 'initialize' and what should be done in 'run'? Both of them will be called whenever the class is used.
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
l_tonz has joined #ruby
jenrzzz has joined #ruby
prutheus has quit [Quit: Page closed]
l_tonz has quit [Ping timeout: 248 seconds]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dviola has joined #ruby
bronson has joined #ruby
l_tonz has joined #ruby
cdg has quit [Remote host closed the connection]
cdg has joined #ruby
bronson has quit [Ping timeout: 240 seconds]
orbyt_ has joined #ruby
<Radar>
conceivably: can you show us what code you have now? It'd be easier to talk to code than theoreticals.
<yeoman>
eam: my problem wasn't the blocking
<yeoman>
it was.. that if i don't say how much should be read
<eam>
yeoman: ah, what's the problem?
<yeoman>
it blocks.. for how long?
<yeoman>
i certainly shouldn't read byte by byte, should i
<eam>
I would characterize that as having a problem with the blocking :)
<yeoman>
ewll.. what does sysread do? raise?
<eam>
so first lemmie talk about read
<yeoman>
this is not really ruby specific i always wondered about that
<eam>
#read is going to make zero or more system calls to read(2)
John__ has quit [Read error: Connection reset by peer]
<eam>
and if you give it no size it will read it all
<eam>
which means blocking until the connection is closed
<yeoman>
even a flush doesn't unblock it?
<yeoman>
so how do people do it.. generally.. i mean
<eam>
so fd.read() literally means read everything
<yeoman>
let's say i read 400 bytes
GremL1N2 has joined #ruby
<yeoman>
client sends 399 and that's the last thing he sends
mahlon has quit [Ping timeout: 252 seconds]
<eam>
fd = open "foo.iso"; buf = fd.read # you're asking to read a few gigs into buf
cdg has quit [Ping timeout: 276 seconds]
<yeoman>
i think the message should be 400 bytes long.. but client things it's 399
<yeoman>
thinks*
mahlon has joined #ruby
<yeoman>
how do people fix that problem?
<eam>
fd.read is really a big while loop that makes lots of smaller calls to read(2) until nothing more can be read
<eam>
does that make sense?
BTRE has quit [Read error: Connection reset by peer]
<yeoman>
yeah.. well.. how do i read everything that is there?
<eam>
so generally when you're using select() to multiplex i/o to sockets (and or do other things in the meantime) you're going to want to construct a state machine that looks like
<conceivably>
Radar: Well there is almost no code to show yet, since I was trying to decide where to start putting it (but perhaps this is the wrong approach?). The class is a 'Report' that is initialized with some input, grabs some things from a database, makes an api call, and finally produces a more or less deeply nested hash as a result of calling run. So it seesm to me that constructing the hash should go into 'run'. But what about retrieving
<conceivably>
things from the database and the api?
<eam>
1) is it ready for some amount of i/o 2) do as much i/o as you can, saving the result in a buffer 3) goto 1
<yeoman>
yeah well
<yeoman>
step 2 is the thing that bugs me
l_tonz has quit [Ping timeout: 264 seconds]
<eam>
ok so how to do #2
<eam>
fd.sysread 4096
<eam>
read up to 4k
<yeoman>
yeah.. well, what if client sends 4095
<eam>
if there's more than 4k, that's fine, you loop back around to select and it returns right away
<eam>
yeoman: that is fine, fd.read 4096 will return *up to* 4k
<eam>
if there's one byte on the wire, you get one byte
<yeoman>
oh.. that's where my misunderstanding was
<eam>
and it tells you how many bytes you read
BTRE has joined #ruby
<eam>
yeah no prob
<yeoman>
then i don't have problems
<eam>
also
<yeoman>
confusing that it's reading it all without params
<eam>
you should read up on what else it can return, if select says ready and you read zero bytes, that means EOF
<eam>
and various other exceptions or return codes can matter as well
<yeoman>
good to know, thanks
<yeoman>
heading to bed, thanks alot
<eam>
np
<yeoman>
eam: i've never seen you around here
<yeoman>
who are you?
<eam>
I am ... me!
<eam>
I'm around sometimes
<yeoman>
i really wanna know~
<yeoman>
who who, who whoi
<yeoman>
or something like that.
<eam>
I love that song
<yeoman>
me too
<yeoman>
i've been here alot, weird that i can't recall your nick
<yeoman>
maybe it's a timezone thing
<yeoman>
are you us?
troys_ is now known as troys
orbyt_ has quit [Max SendQ exceeded]
<Radar>
conceivably: The question you should be asking is: should the retrieving of the data be done when the object is initialized, or when the "run" method is called?
elphe has joined #ruby
PaulCapestany has quit [Quit: .]
<Radar>
conceivably: I think when the run method is called.
milardovich has joined #ruby
g105b has quit [Quit: Page closed]
cdg has joined #ruby
<eam>
yeah I'm in California
<yeoman>
eam: how do people write multi client servers with IO.select in ruby?
PaulCapestany has joined #ruby
<yeoman>
i have a Thread that does accepting and selecting and puts them into a hash in a class
sanscoeur has quit [Remote host closed the connection]
conceivably has quit [Ping timeout: 276 seconds]
cdg has quit [Ping timeout: 248 seconds]
guacamole has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
marxarelli|afk is now known as marxarelli
solocshaw has joined #ruby
Emmanuel_Chanel has quit [Ping timeout: 264 seconds]
<eam>
yeoman: you can either multiplex within a single thread, or do a thread-per-connection model
<eam>
(or some hybrid variation thereof when you get very high performance)
<eam>
I have a kinda simple example of multiplexing multiple connections here, if you wanna take a look. It's very much *not* abstracted so hopefully it's sort of easy to piece apart https://github.com/square/mssh/blob/master/lib/mcmd.rb
<eam>
it's somewhat of a mess, this was one of the first things I wrote when I came back to ruby after about a decade away from it
<eam>
in this case it's multiplexing pipes to subprocesses, but the mechanism is more or less the same