<havenwood>
sqljunkey: What's the error you're getting? Gist it?
r_rios has quit [Ping timeout: 258 seconds]
<soulisson>
havenwood, thank you very much
<havenwood>
soulisson: you're welcome!
<sqljunkey>
NoMethodError: undefined method `ticker_names' for nil:NilClass
<sqljunkey>
from stock_summary.rb:64
<sqljunkey>
I do not know how to use gist yet
<sqljunkey>
heh
<sqljunkey>
shame on me
nankyokusei has quit [Ping timeout: 258 seconds]
Qommand0r has quit [Quit: Exiting...]
Dreamer3 has quit [Quit: Leaving...]
<sqljunkey>
I jst placed a sample but yeah it's giving me an error where I call t.ticker_names.foreach do |tick|
millerti has joined #ruby
hahuang61 has joined #ruby
<soulisson>
havenwood, I'm using this line sock = TCPSocket.new("192.168.1.253", 445, local_port=5556), the connection is established, but it uses a random local port
qguv has joined #ruby
<havenwood>
soulisson: Local host is the third argument and local port is the fourth.
<soulisson>
havenwood, but in this case I named the argument, so it shouldn't be an issue, no?
<sqljunkey>
I did make the ticker_names accessible.... with attrb_accessor :ticker_names
<havenwood>
soulisson: Naming arguments doesn't work that way. Regular arguments are indicated by position. There are keyword arguments now but these aren't those.
bambanx has quit [Read error: Connection reset by peer]
<jhass>
oh it's already there
<jhass>
I never noticed
<djellemah>
;-)
pokalyis has quit [Read error: Connection reset by peer]
pokalyis has joined #ruby
<jhass>
thank you
conta has joined #ruby
MrBusiness2 has joined #ruby
blackmesa has quit [Ping timeout: 250 seconds]
dionysus69 has quit [Ping timeout: 250 seconds]
MrBusiness3 has quit [Ping timeout: 250 seconds]
alfiemax has joined #ruby
jackjackdripper has quit [Quit: Leaving.]
harfangk has joined #ruby
elifoster has quit [Quit: sleep]
MrBusiness3 has joined #ruby
jarred has quit [Quit: Connection closed for inactivity]
joonty has quit [Quit: This computer has gone to sleep]
scottbarr has quit [Ping timeout: 240 seconds]
heysin has quit [Ping timeout: 258 seconds]
kiba_ has quit [Ping timeout: 250 seconds]
MrBusiness2 has quit [Ping timeout: 250 seconds]
kiba_ has joined #ruby
A_Drone has quit [Remote host closed the connection]
amclain has quit [Quit: Leaving]
jeanlinu_ has joined #ruby
jeanlinux has quit [Ping timeout: 244 seconds]
tdy has quit [Quit: WeeChat 1.5]
pokalyis has quit [Read error: Connection reset by peer]
kedibasi has quit [Quit: kedibasi has no reason]
pokalyis has joined #ruby
blackgoat has joined #ruby
blackgoat has quit [Client Quit]
sumobob has joined #ruby
MrBusiness2 has joined #ruby
kus has joined #ruby
MrBusiness3 has quit [Ping timeout: 250 seconds]
MrBusiness3 has joined #ruby
MrBusiness2 has quit [Ping timeout: 250 seconds]
tdy has joined #ruby
dionysus69 has joined #ruby
the_rhizo2 has joined #ruby
icalo has joined #ruby
icalo is now known as ignazioc
SteenJobs has quit [Quit: SteenJobs]
lxsameer_ has joined #ruby
<ignazioc>
Hi everyone. I never used IRC before and I’m looking for a different type of ruby community. Something like a forum or a facebook group. Does someone has a link or a suggestion?
the_rhizo2 has quit [Ping timeout: 260 seconds]
sameerynho has quit [Ping timeout: 240 seconds]
fgo has quit [Ping timeout: 265 seconds]
firstdayonthejob has joined #ruby
minotep has quit [Ping timeout: 244 seconds]
TheWhip has quit [Remote host closed the connection]
MrBusiness3 has quit [Ping timeout: 250 seconds]
cyphase has quit [Ping timeout: 252 seconds]
TheWhip has joined #ruby
ramfjord has joined #ruby
cyphase has joined #ruby
Bish has quit [Ping timeout: 240 seconds]
blackmesa has joined #ruby
ramfjord has quit [Ping timeout: 258 seconds]
LoneHer__ has quit [Remote host closed the connection]
<jhass>
metaruby.com, but why don't you give us a chance? ;)
karapetyan has joined #ruby
Z3N1T has quit [Read error: Connection reset by peer]
fgo has joined #ruby
<jhass>
ignazioc: ^
axsuul has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Z3N1T has joined #ruby
<ignazioc>
jhass: I think it’s hard to follow multiple conversation or perform a search on a single chat.
tomphp has joined #ruby
karapetyan has quit [Ping timeout: 244 seconds]
<ignazioc>
btw I’m not a real gury with ruby but I like it and I wrote a client for quizlet.com https://github.com/ignazioc/QuizletNerdClient it’s still very very bad but I would like to receive some comments.
craysiii has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jhass>
that's why we don't scold you for asking something that came up before ;)
MrBusiness3 has joined #ruby
<jhass>
you could make it a gem
yardenbar has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jhass>
relying on nil being falsey also isn't unseen, so unless response.error in this case, or PreferenceManager.client_id && PreferenceManager.app_secret further down
<jhass>
ignazioc: I'd probably extract the API URL building into a method, so you just api_call :post, :sets, set, params: { ... } or so
blackmesa has quit [Ping timeout: 265 seconds]
<jhass>
PreferenceManager I would make either a module or a singleton (tendency to the latter), or doing something like SETTINGS = PreferenceManager.new
<jhass>
and do a if settings.has_key? :app_secret to guard against it returning nil
<jhass>
eh nvm ^
<jhass>
if settings just
<ignazioc>
the only reason why I added a “begin / rescue” is because the file can not exist
<jhass>
then use File.exist? to check for that
TheWhip has quit [Remote host closed the connection]
<jhass>
alright, rubocop should do the rest, I've seen worse before, nice job
<matthewd>
foxxx0: to_hash raises an eyebrow for me
<ignazioc>
:) thanks a lot. I will do some cleanup
nankyokusei has quit [Ping timeout: 244 seconds]
<matthewd>
foxxx0: Mostly I guess I'd worry about how these combine to construct a more complex / multi-element field
<matthewd>
foxxx0: The complexity of classes-and-objects, but by seemingly not having them do their own rendering, it feels like it could become a (rather verbose) straight-jacket
hahuang61 has joined #ruby
<foxxx0>
matthewd: i'm just trying to let the models propagate their own field set so i can use a generic haml form template to render it
tomphp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
dionysus69 has quit [Ping timeout: 276 seconds]
<foxxx0>
i'm still pretty new to ruby though so maybe i'm just trying to approach the task at hand completely wrong
<foxxx0>
that's why i'm asking for feedback, which is always greatly appreciated
snapcase has quit [Remote host closed the connection]
<matthewd>
Every time I've tried to objectify form definitions, it's ended up biting me later
Dimik has quit [Ping timeout: 276 seconds]
hahuang61 has quit [Ping timeout: 250 seconds]
yqt has joined #ruby
zarubin has quit [Read error: Connection reset by peer]
zarubin has joined #ruby
MrBusiness3 has quit [Ping timeout: 250 seconds]
Jet4Fire has joined #ruby
<foxxx0>
why is that?
<Jet4Fire>
Hello!
<jhass>
hi
the_rhizo2 has joined #ruby
Trynemjoel has quit [Ping timeout: 244 seconds]
the_rhizo2 has quit [Ping timeout: 244 seconds]
kavanagh has quit [Ping timeout: 244 seconds]
saneax_AFK is now known as saneax
cd-rum_ has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
saneax is now known as Guest83574
Trynemjoel has joined #ruby
fgo has quit [Ping timeout: 244 seconds]
bjh13 has quit [Remote host closed the connection]
pokalyis has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sumobob has quit [Ping timeout: 260 seconds]
pokalyis has joined #ruby
jgt has joined #ruby
rsampaio_ has quit [Ping timeout: 250 seconds]
hahuang61 has joined #ruby
queitsch has joined #ruby
beilabs has quit [Remote host closed the connection]
minotep has joined #ruby
phredus has quit [Remote host closed the connection]
hahuang61 has quit [Ping timeout: 250 seconds]
Ishido has quit [Read error: Connection reset by peer]
Ishido has joined #ruby
beilabs has joined #ruby
pokalyis has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pokalyis has joined #ruby
rippa has joined #ruby
zarubin has quit [Ping timeout: 276 seconds]
zarubin has joined #ruby
the_rhizo2 has joined #ruby
dminuoso has joined #ruby
pandaant has joined #ruby
beilabs has quit [Remote host closed the connection]
last_staff has joined #ruby
pmyjavec has quit [Ping timeout: 244 seconds]
biomass_ has joined #ruby
kus has quit [Ping timeout: 240 seconds]
zeroDi has joined #ruby
the_rhizo2 has quit [Ping timeout: 260 seconds]
SCHAAP137 has joined #ruby
alfiemax has quit [Ping timeout: 265 seconds]
pokalyis has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
fgo has quit [Ping timeout: 265 seconds]
queitsch has quit [Ping timeout: 252 seconds]
pokalyis has joined #ruby
craigp_ has quit [Ping timeout: 260 seconds]
yuki_is_bored has joined #ruby
pawnbox has quit [Ping timeout: 250 seconds]
last_staff has quit [Quit: last_staff]
pokalyis has quit [Client Quit]
ptierno has joined #ruby
snapcase has joined #ruby
pokalyis has joined #ruby
ignazioc has quit [Quit: ignazioc]
ptierno has left #ruby [#ruby]
symm- has joined #ruby
LoneHermit has joined #ruby
<foxxx0>
how do i write to a class property by using send/public_send or something similar, i want to use a variable to specify the class property name
<Mon_Ouie>
define_singleton_method(name) do … end
<foxxx0>
example: i have a class Domain that has a property 'user_opts', that can be written to using: my_domain = Domain.new; my_domain.user_opts = 'foo';
<Mon_Ouie>
and instance_variable_(get|set) (assuming that's what you mean by a property)
pokalyis has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pawnbox has joined #ruby
tomphp has joined #ruby
Bish has joined #ruby
<matthewd>
At a higher level, if you're getting started in the language, I'd recommend Rails over re-carving these particular wheels
pokalyis has joined #ruby
<matthewd>
That certainly won't be a universal opinion.. but it feels like it'd get you past a certain level of "trying to write [other language] in ruby"
tomphp has quit [Client Quit]
<matthewd>
(I'm also obviously somewhat biased)
<foxxx0>
i find that doing stuff yourself and asking for feedback from some advanced people in that particular language if you're doing it the $language-way is actually way better
<foxxx0>
it's not that i just want to build stuff, i want to learn the language and i'm not afraid to get my hands dirty :p
<matthewd>
I guess I'm saying I'd favour starting with a higher level thing, then progressively tearing it down to its parts
<foxxx0>
jhass: what exactly do you mean by @users.each_value.map? instead of the @users.each_value do |u|?
<jhass>
yes and then instead of .push'ing manually
nikivi has quit [Quit: irc]
<matthewd>
Whichever way works for you is obviously the best choice.. I just feel like this direction takes longer to stamp out the last of the feeling of 'otherness'. Or something.
<foxxx0>
jhass: how do i pass a block to .map?
nankyokusei has joined #ruby
craigp_ has joined #ruby
<foxxx0>
matthewd: sounds reasonable, but, don't get me wrong, i'm not a fan of "magical generators" and i feel like rails is pretty bloated, that's precisely why i like sinatra
beilabs has joined #ruby
pmyjavec has joined #ruby
<jhass>
foxxx0: just do it?
duncannz has quit [Remote host closed the connection]
<foxxx0>
what do i with models that have numerous properties/instance-variables, rubocop is rightfully complaining about initialize method having too many lines and ABC size too high
pokalyis has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ramfjord has joined #ruby
omphe has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
firstdayonthejob has quit [Ping timeout: 276 seconds]
ramfjord has quit [Ping timeout: 258 seconds]
Hyuk has joined #ruby
pokalyis has joined #ruby
<jhass>
tbh most of us set the defaults higher for these
Hyuk has quit [Client Quit]
AlexRussia has quit [Ping timeout: 276 seconds]
LoneHermit has joined #ruby
beilabs_ has joined #ruby
<foxxx0>
generally i like the idea
<foxxx0>
would be great if one could override that cop for a single method by using a comment
<foxxx0>
from within the file
beilabs has quit [Remote host closed the connection]
anisha has quit [Quit: This computer has gone to sleep]
ma489 has joined #ruby
MrBusiness2 has joined #ruby
VladGh has quit [Remote host closed the connection]
ma489 has left #ruby [#ruby]
craigp_ has joined #ruby
blackmesa has quit [Ping timeout: 244 seconds]
VladGh has joined #ruby
hosttor has joined #ruby
pawnbox has joined #ruby
GinoMan2440 has quit [Ping timeout: 250 seconds]
hahuang61 has joined #ruby
last_staff has quit [Remote host closed the connection]
last_staff has joined #ruby
hahuang61 has quit [Ping timeout: 250 seconds]
gfvcastro has joined #ruby
l4v2 has quit [Quit: l4v2]
Dimik has joined #ruby
enterprisey has quit [Remote host closed the connection]
finisherr has joined #ruby
zacts has quit [Ping timeout: 258 seconds]
nando293921 has quit [Ping timeout: 265 seconds]
CodingWolf has joined #ruby
MrBusiness2 has quit [Ping timeout: 250 seconds]
habitullence has quit [Quit: habitullence]
l4v2 has joined #ruby
shellie_ has quit [Remote host closed the connection]
habitullence has joined #ruby
MrBusiness2 has joined #ruby
unforgiven512 has quit [Ping timeout: 250 seconds]
l4v2 has quit [Quit: l4v2]
ramfjord has joined #ruby
gfvcastro has quit [Read error: Connection reset by peer]
tk__ has quit [Quit: ばいばい]
nikivi has joined #ruby
DaniG2k has joined #ruby
<DaniG2k>
hello all
<DaniG2k>
I'm trying to set the values of the diagonals of a matrix using Ruby
<DaniG2k>
with something like the following:
<DaniG2k>
matrix = Array.new(5, Array.new(n, 5))
<DaniG2k>
oops I mean
ramfjord has quit [Ping timeout: 244 seconds]
<DaniG2k>
matrix = Array.new(5, Array.new(5, 0))
<DaniG2k>
that should initialize a 5x5 matrix with zeros
<DaniG2k>
and then I do
<DaniG2k>
(0..4).each {|i| matrix[i][i] = i}
<DaniG2k>
in theory that should set the numbers of the diagonals
<DaniG2k>
oddly, it sets all columns in all rows
<DaniG2k>
is that a bug in Ruby or am I doing something incorrectly?
bluOxigen has quit [Ping timeout: 276 seconds]
bluOxigen has joined #ruby
ddffg has quit [Ping timeout: 276 seconds]
pmyjavec has joined #ruby
zacts has joined #ruby
axsuul has joined #ruby
banisterfiend has quit [Ping timeout: 265 seconds]
minotep has quit [Quit: minotep]
<zacts>
ruby is very cool
<zacts>
I <3 ruby
<zacts>
:-)
sepp2k1 has joined #ruby
<apeiros>
DaniG2k: Array.new does not copy the object in your second arg
<apeiros>
so you have the exactly same array as every element in your new array
SCHAAP137 has quit [Quit: Leaving]
<apeiros>
use the block-form for that. the block is executed once for every element it should create in the initial array, therefore it'll be distinct arrays.
sepp2k has quit [Ping timeout: 276 seconds]
<DaniG2k>
block-form?
<DaniG2k>
how do I do that?
<apeiros>
Array.new(n) { …create nth element… }
<DaniG2k>
ah gotcha
CodingWolf has quit [Read error: Connection reset by peer]
nanoz has quit [Read error: Connection reset by peer]
nanoz has joined #ruby
nanoz has quit [Changing host]
nanoz has joined #ruby
davedev24 has joined #ruby
<DaniG2k>
apeiros: perfect
<DaniG2k>
thanks
firstdayonthejob has joined #ruby
blackmesa has joined #ruby
d5sx43 has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
d5sx43 has quit [Client Quit]
SCHAAP137 has joined #ruby
anisha has joined #ruby
<apeiros>
yw
mikecmpbll has joined #ruby
rileyy has joined #ruby
jaequery has joined #ruby
blackmesa has quit [Ping timeout: 244 seconds]
edwardly has quit [Ping timeout: 244 seconds]
l4v2 has joined #ruby
mikecmpbll has quit [Client Quit]
sergey_makagon has joined #ruby
nanoz] has joined #ruby
jaequery has quit [Ping timeout: 265 seconds]
anisha has quit [Ping timeout: 258 seconds]
sergey_makagon has quit [Client Quit]
edwardly has joined #ruby
edwardly has quit [Changing host]
edwardly has joined #ruby
nanoz] has quit [Read error: Connection reset by peer]
nanoz has quit [Ping timeout: 276 seconds]
rileyy has quit [Ping timeout: 258 seconds]
anisha has joined #ruby
nankyokusei has joined #ruby
l4v2 has quit [Quit: l4v2]
davedev2_ has joined #ruby
DaniG2k has quit [Quit: leaving]
davedev24 has quit [Ping timeout: 250 seconds]
nankyokusei has quit [Ping timeout: 250 seconds]
Jet4Fire has quit [Quit: Lost terminal]
<foxxx0>
jhass: just figured out: you can use 'localhost.localdomain' for the Rack::Session::Cookie domain setting and then access the app through http://localhost.localdomain:9494/ and cookies will work, even with curl
<foxxx0>
jhass: so there is no need for an explicit domain name in /etc/hosts + matching domain cookie setting
<jhass>
interesting
kobain has joined #ruby
<foxxx0>
just assumed you would like a followup on that
sumobob has joined #ruby
pmyjavec has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
da3mon has joined #ruby
lupine has quit [Remote host closed the connection]
SCHAAP137 has quit [Remote host closed the connection]
jarred has joined #ruby
ramfjord has joined #ruby
SCHAAP137 has joined #ruby
rails536 has quit [Ping timeout: 264 seconds]
jrafanie has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ramfjord has quit [Ping timeout: 264 seconds]
houhoulis has quit [Remote host closed the connection]
jrafanie has joined #ruby
blackmesa has joined #ruby
axsuul has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
vuoto has quit [Remote host closed the connection]
vuoto has joined #ruby
da3mon has quit [Quit: Zzzz...]
conta has quit [Ping timeout: 264 seconds]
LoneHerm_ has joined #ruby
ignazioc has joined #ruby
roamingdog has joined #ruby
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
LoneHerm_ has quit [Ping timeout: 252 seconds]
Burgestrand has joined #ruby
da3mon has joined #ruby
Rodya_ has joined #ruby
da3mon has quit [Client Quit]
sneakerhax has quit [Remote host closed the connection]
sneakerhax has joined #ruby
stamina has joined #ruby
soulisson has joined #ruby
<soulisson>
Hi, I'm using recv on a udp socket, I receeive an ICMP port unreachable port response, however the sockets keeps trying to receive, is there something I can do?
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<soulisson>
I expect an exceptio to be raised but this is not the case, is there an option I'm missing or something
<ellistaa>
i dont know what a udp socket is or an ICMP port :\
KnownSyntax has quit [Ping timeout: 265 seconds]
sumobob has quit [Ping timeout: 250 seconds]
tdw has joined #ruby
hahuang61 has quit [Ping timeout: 250 seconds]
nikivi has quit [Quit: irc]
sumobob has joined #ruby
da3mon has joined #ruby
nikivi has joined #ruby
vuoto_ has joined #ruby
blackwell has quit [Ping timeout: 244 seconds]
vuoto_ has quit [Remote host closed the connection]
vuoto_ has joined #ruby
vuoto_ has quit [Remote host closed the connection]
vuoto has quit [Remote host closed the connection]
vuoto has joined #ruby
nikivi has quit [Quit: irc]
blackwell has joined #ruby
sumobob has quit [Ping timeout: 264 seconds]
blackwell has quit [Client Quit]
miqlas-H has quit [Ping timeout: 250 seconds]
lel has quit [Read error: Connection reset by peer]
nikivi has joined #ruby
nikivi has quit [Client Quit]
ignazioc has quit [Quit: ignazioc]
da3mon has quit [Quit: cya...]
AzureStigma has joined #ruby
blackwell has joined #ruby
sumobob has joined #ruby
axsuul has joined #ruby
spudowiar has quit [Quit: cya'll later]
tdy has quit [Quit: WeeChat 1.5]
Pumukel_ has joined #ruby
tdy has joined #ruby
lel has joined #ruby
<soulisson>
Is there a path where the gems are installed?
Pumukel__ has joined #ruby
Pumukel has quit [Ping timeout: 260 seconds]
Spami has quit [Quit: This computer has gone to sleep]
ellistaa has quit [Quit: ellistaa]
Spami has joined #ruby
Spami has quit [Client Quit]
<havenwood>
soulisson: gem env gemdir
Pumukel has joined #ruby
<soulisson>
havenwood, when I do require looks in this path?
Pumukel_ has quit [Ping timeout: 260 seconds]
Rodya_ has quit [Remote host closed the connection]
<havenwood>
soulisson: that'd be: gem env gempath
Pumukel_ has joined #ruby
<havenwood>
soulisson: see: gem help env
Pumukel__ has quit [Ping timeout: 260 seconds]
ponga has quit [Quit: Connection closed for inactivity]
<soulisson>
thanks
vuoto has quit [Remote host closed the connection]
AlexRussia has joined #ruby
dreamyspell has joined #ruby
Pumukel__ has joined #ruby
Pumukel has quit [Ping timeout: 260 seconds]
craysiii has joined #ruby
Pumukel_ has quit [Ping timeout: 260 seconds]
Pumukel has joined #ruby
diegoviola is now known as dviola
<soulisson>
Sorry to bother you again in gem env gempath, one of the folders is /var/lib/gems/2.3.0 but the librairies are in the /var/lib/gems/2.3.0/gems/xxx/lib folder, does the require takes the first folder and knows where to go from there?
<matthewd>
Yes. (Approximately.)
Pumukel__ has quit [Ping timeout: 260 seconds]
<soulisson>
matthewd, thanks
<soulisson>
Ruby is so rich, sometimes is a little bit hard for dumb people like me to get everything ::)
hahuang61 has joined #ruby
Pumukel_ has joined #ruby
workmad3 has joined #ruby
fmcgeough has quit [Read error: Connection reset by peer]
fmcgeough has joined #ruby
Pumukel__ has joined #ruby
Derperperd has joined #ruby
Pumukel has quit [Ping timeout: 260 seconds]
<sqljunkey>
I have two arrays of same size, (5 elements in each) one is filled with strings that say "ICE" and the other has five strings that say "CREAM" is there an easy way I can combine the two arrays together so they will create an array that says "ICECREAM" ?
lightstalker has quit [Remote host closed the connection]
lightstalker has joined #ruby
loechel has quit [Quit: ChatZilla 0.9.92 [Firefox 48.0/20160726073904]]
Pumukel__ has quit [Ping timeout: 264 seconds]
Axy has joined #ruby
Pumukel has quit [Ping timeout: 264 seconds]
workmad3 has quit [Ping timeout: 276 seconds]
bluOxigen has quit [Ping timeout: 260 seconds]
yfeldblum has joined #ruby
Pumukel has joined #ruby
zarubin_ has joined #ruby
bkxd has quit [Ping timeout: 252 seconds]
Mia has quit [Ping timeout: 258 seconds]
Pumuke___ has quit [Ping timeout: 264 seconds]
jrafanie has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
skweek has joined #ruby
zarubin has quit [Ping timeout: 252 seconds]
<sqljunkey>
ok thx
cdg has joined #ruby
loechel has joined #ruby
lightstalker has quit [Remote host closed the connection]
karapetyan has quit [Remote host closed the connection]
axsuul has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
karapetyan has joined #ruby
yardenbar has quit [Ping timeout: 244 seconds]
Pumukel has quit [Ping timeout: 264 seconds]
Pumukel_ has joined #ruby
lightstalker has joined #ruby
Pumukel_ has quit [Read error: Connection reset by peer]
Pumukel has joined #ruby
Pumukel_ has joined #ruby
loechel has quit [Ping timeout: 264 seconds]
iLogic has quit [Remote host closed the connection]
loechel has joined #ruby
sumobob has quit [Ping timeout: 276 seconds]
Pumukel has quit [Ping timeout: 260 seconds]
Pumukel__ has joined #ruby
AzureStigma is now known as AzureStigma|Away
AzureStigma|Away has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Pumukel_ has quit [Ping timeout: 264 seconds]
Pumukel has joined #ruby
loechel has quit [Ping timeout: 264 seconds]
nertzy has joined #ruby
nankyokusei has joined #ruby
SteppenII has joined #ruby
loechel has joined #ruby
Pumukel__ has quit [Ping timeout: 264 seconds]
Pumukel_ has joined #ruby
Pumukel has quit [Ping timeout: 264 seconds]
yfeldblu_ has joined #ruby
yfeldblu_ has quit [Remote host closed the connection]
nankyokusei has quit [Ping timeout: 264 seconds]
yfeldblu_ has joined #ruby
loechel has quit [Ping timeout: 264 seconds]
AlexRussia has quit [Ping timeout: 265 seconds]
yfeldblum has quit [Ping timeout: 240 seconds]
Pumukel has joined #ruby
Pumukel_ has quit [Ping timeout: 264 seconds]
nertzy has quit [Quit: This computer has gone to sleep]
loechel has joined #ruby
<kiba_>
hello
<kiba_>
rake takes some seconds to turn
<kiba_>
err
<kiba_>
run
<kiba_>
how can I speed up the process?
Pumukel has quit [Ping timeout: 264 seconds]
Pumukel_ has joined #ruby
nertzy has joined #ruby
Pumukel has joined #ruby
<matthewd>
kiba_: Put less in your rakefile?
<kiba_>
that's not really an answer
loechel has quit [Ping timeout: 264 seconds]
<kiba_>
for what it's worth, my Rakefile is really simple. It doesn't depend on any gem other than itself and json
the_rhizo2 has joined #ruby
loechel has joined #ruby
<matthewd>
kiba_: I don't think you've given enough information for a more insightful answer. Do you?
Pumukel_ has quit [Ping timeout: 264 seconds]
Pumukel has quit [Ping timeout: 264 seconds]
<kiba_>
OK, it's variable in response. I just tested it out by repeating the command.
<kiba_>
maybe I just need to get a SSD
miqlas-H has joined #ruby
<apeiros>
"the code is slow, what should I do" - write faster code.
karapetyan has quit [Remote host closed the connection]
<apeiros>
alternatively as matthewd already told you: provide sensible information.
<apeiros>
you can run your code with a profiler (ruby -rprofile) to profile your code.
loechel has quit [Ping timeout: 264 seconds]
Pumukel has joined #ruby
arquebus has joined #ruby
ellistaa has joined #ruby
karapetyan has joined #ruby
loechel has joined #ruby
Pumukel has quit [Ping timeout: 264 seconds]
nertzy has quit [Ping timeout: 265 seconds]
al2o3-cr has joined #ruby
lel has quit [Read error: Connection reset by peer]
miqlas-H has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
loechel has quit [Ping timeout: 264 seconds]
lel has joined #ruby
karapetyan has quit [Remote host closed the connection]
tvw has joined #ruby
pokalyis has quit [Read error: Connection reset by peer]
Pumukel has joined #ruby
pokalyis has joined #ruby
<arquebus>
hello, Im trying to make a class object with class methods that call instance methods, basically I need the method call at the bottom of the code to work, can anyone help? http://codepad.org/lxqGpWzI
karapetyan has joined #ruby
riskish has joined #ruby
Pumukel has quit [Ping timeout: 264 seconds]
<matthewd>
arquebus: Don't use class variables
Pumukel has joined #ruby
<matthewd>
arquebus: If you want a class method to return an instance, it should be calling new
<arquebus>
matthewd: ok, I left out the new part
<foxxx0>
Temperature.new(c: 50).in_celsius
<foxxx0>
you need to create an instance of your class if you want to use it like that
<arquebus>
but I cant change the code, I need that exact code to work to pass rspec tests
blackmesa has quit [Ping timeout: 264 seconds]
<foxxx0>
that would mean the rspec tests are poorly designed
jeanlinu_ has quit [Ping timeout: 276 seconds]
<arquebus>
foxxx0: I am doing an exercise where I have to create factory functions using class methods, of course it would be easier to just make class instance objects but I cant do that
<foxxx0>
that sounds terrible
<foxxx0>
but try Temperature.new(c: 50).in_celsius
nertzy has joined #ruby
<arquebus>
foxxx0: well class methods are used a lot as factory functions, I just cant find any ruby books that explain how to do it
<matthewd>
"call new". End of book. ¯\_(ツ)_/¯
<apeiros>
all classes in ruby are factories. after all, you call a class method (new) to create a new instance.
<foxxx0>
from what i understand factories are used to create temporary instances of your models/classes, not to call/use any methods on them
l4v2 has quit [Quit: l4v2]
<apeiros>
and any class method you write can call new itself too.
<arquebus>
foxxx0: I would like to, but I cant, I have to use that exact code to make the tests pass, there must be some way to set up a class so these class methods will work like that
Pumukel has quit [Ping timeout: 264 seconds]
<foxxx0>
so do you need to make 'puts Temperature.from_celsius(50).in_celsius' work or do you need to build a factory that represents the given temperature class and is able to use the .in_celsius class method?
Pumukel has joined #ruby
<arquebus>
apeiros: when I say factories, I mean the design pattern that is similar to singleton. Im not sure if the tests are still using a previously created Temperature class of this is being instantiated on its own
<apeiros>
arquebus: and I concur with matthewd - the class variables there are clearly wrong. it means *all* your Temperature instances share *the same* temperature. it makes the class utterly pointless.
<apeiros>
arquebus: yes, I understood that re factories. maybe you read up on that pattern again? :-p
gfvcastro has joined #ruby
<arquebus>
apeiros: that is kind of the point, you have these class objects that get instantiated just to run a method, they are doing high level stuff that is *the same* no matter what instance objects exist
gizmore has quit [Remote host closed the connection]
<foxxx0>
no, it is plain stupid
<apeiros>
arquebus: I think you misunderstood the factory pattern.
<arquebus>
apeiros: I admit that, I am only vaguely familiar with factory patterns as a standalone object that is only created once to produce something over and over
Pumukel has quit [Ping timeout: 264 seconds]
JeanCarloMachado has joined #ruby
<apeiros>
a factory method facilitates creating an instance. either by resolving the class, or by transforming the input to fit the constructor. your case is - as the example IMO plainly shows - the latter.
stamina has quit [Ping timeout: 240 seconds]
<arquebus>
apeiros: thats great, thats exactly what I need to do, how should I alter my program to do that?
<apeiros>
in your example, `puts Temperature.from_celsius(50).in_celsius`, the `Temperature.from_celsius(50)` call is obviously supposed to return a Temperature instance.
<matthewd>
arquebus: call. new.
<foxxx0>
^
<apeiros>
so what you do is you write your `from_celsius` class method accordingly. and as plenty of people already told you by now - that method can use `new`.
SCHAAP137 has quit [Remote host closed the connection]
l4v2 has joined #ruby
nertzy has quit [Ping timeout: 244 seconds]
<arquebus>
apeiros: ok, but as I said I cant alter that calling method, that is part of the test, so I am going to have to call new from inside the from_celsius method
Rodya_ has joined #ruby
<apeiros>
you mean you can't alter `puts Temperature.from_celsius(50).in_celsius`, yes?
spudowiar has joined #ruby
<arquebus>
apeiros: yes, I cant alter that at all
<apeiros>
then maybe read again what I wrote.
<apeiros>
because neither I, nor anybody else said you should alter that.
<arquebus>
ok, I will read over what you said, thanks for the help on this
<matthewd>
> I am going to have to call new from inside the from_celsius method
<matthewd>
Yes. Do that.
<arquebus>
matthewd: great, this helps me a lot
the_rhizo3 has joined #ruby
roamingdog has quit [Remote host closed the connection]
<foxxx0>
arquebus: can you tell us where you got those exercises/assignments from? i'm just curious to know what i should avoid
Pumukel has joined #ruby
the_rhizo2 has quit [Ping timeout: 240 seconds]
<arquebus>
foxxx0: its study prep for a bootcamp, I dont want to reveal which one
<foxxx0>
okay then
<matthewd>
foxxx0: Seems pretty ordinary to me
<apeiros>
well, if it truly uses class variables in that code, then it's pretty bad.
roamingd_ has joined #ruby
<foxxx0>
entirely my point
<foxxx0>
i'm not questioning the task itself, rather than the environment and provided source code
<arquebus>
apeiros: the class variables were my idea, I couldnt figure out how to make a class object work alone without class variables
<matthewd>
AIUI, only the last line was supplied
rippa has quit [Read error: Connection reset by peer]
soulisson_ has joined #ruby
<foxxx0>
oh really?
<foxxx0>
i thought he couldnt change the class?
<apeiros>
matthewd: I assumed they provided a skeleton class
Pumukel has quit [Ping timeout: 264 seconds]
<foxxx0>
maybe i'm just confused or totally misunderstood the problem ¯\_(ツ)_/¯
SCHAAP137 has joined #ruby
<arquebus>
no, I wrote all of the class, there is no class provided, I only have to create a class object that can pass all the rspec tests they provide
Pumukel has joined #ruby
<foxxx0>
then you neither need instance variables nor initialize in your class, IMHO
<arquebus>
foxxx0: wow, then what would I put in the class?
dminuoso has quit [Read error: Connection reset by peer]
JeanCarloMachado has quit [Ping timeout: 250 seconds]
soulisson has quit [Ping timeout: 264 seconds]
SteenJobs has quit [Quit: SteenJobs]
Pumukel has quit [Ping timeout: 264 seconds]
ellistaa has quit [Quit: ellistaa]
leea has joined #ruby
<arquebus>
foxxx0: I have another test that gives the class object a hash parameter when created so I have to have an initialize method, and I need instance methods to hold that input so I can run it through the cels/fahr conversion methods
ellistaa has joined #ruby
mtkd has quit [Ping timeout: 250 seconds]
mtkd has joined #ruby
<foxxx0>
maybe i'm just wrong, didn't see the method chaining so Temperature.from_celsion should return an object that responds to #in_celsions, i'm not sure if that's possible using class methods only, i suppose not
<foxxx0>
and if you need initialize anyway just cleanup the class and make sure to call new in #from_celsius
<foxxx0>
but skip that whole class variable stuff
dgncn has quit [Ping timeout: 250 seconds]
<apeiros>
23:46 apeiros: in your example, `puts Temperature.from_celsius(50).in_celsius`, the `Temperature.from_celsius(50)` call is obviously supposed to return a Temperature instance.
<apeiros>
foxxx0: ^
cd-rum has joined #ruby
SteppenII has quit [Remote host closed the connection]
<apeiros>
and yes, it is very much possible. as explained plenty of times in this very thread :)
SteenJobs has joined #ruby
<apeiros>
(and a proper Temperature class would convert the input temperature to kelvin anyway :-p)
s2013 has joined #ruby
<arquebus>
apeiros: foxxx0: as you can see the from_celsius method takes a numeric parameter, so I just have to pass that parameter into the Temperature.new(arg_name) class intance creation inside the method
Pumukel has joined #ruby
<arquebus>
and then create another if statement in the intialize method to recieve that parameter
<apeiros>
close
elifoster has quit [Quit: out]
<apeiros>
your initialize can deal with it just fine already. all you have to do is call new properly. and that isn't .new(arg_name)
Puck6633 has quit [Quit: Leaving]
<arquebus>
apeiros: how else can I do it, the celsius_from method takes a numeric parameter, what other way can I pass it to .new?
ddffg has quit [Ping timeout: 250 seconds]
<apeiros>
arquebus: do you always call all methods within your method body with all the arguments precisely as passed to the current method?
Pumukel has quit [Ping timeout: 260 seconds]
<apeiros>
forget for a second the Temperature.from_celsius method. how do you create a Temperature with celsius?
<arquebus>
apeiros: I guess not, Im still trying to figure out why I wouldnt take the direct route and pass it directly though
dgncn has joined #ruby
Pumukel has joined #ruby
<apeiros>
pass what where directly?
m00p has joined #ruby
<arquebus>
apeiros: like you said, pass the parameter from the current method to the methods within the method body, precisely as passed to the current method
workmad3 has joined #ruby
Rodya_ has quit [Remote host closed the connection]
<apeiros>
ok. I don't follow. but maybe you could answer my other question (how do you create a Temperature with/in celsius?)
Rodya_ has joined #ruby
<sqljunkey>
how can I re-assign the elements of an array to a different string? arr1.at(3) = "New String"
nofxx has joined #ruby
<baweaver>
use the index
<soulisson_>
In Ruby when the main thread exits, the other threads terminates.
<soulisson_>
?
<baweaver>
arr[3] = new value
<apeiros>
soulisson_: yes
<soulisson_>
apeiros, thanks
anisha_ has joined #ruby
<soulisson_>
apeiros, other than join, is there a way to not exit the process until all threads are complete?
kobain has quit [Ping timeout: 260 seconds]
<arquebus>
apeiros: Im just doing: Temperature.new(param_name) inside the celsius_from method which is called on a class object, the celsius_from method takes a single numeric parameter which I pass straight into the Temperature.new() initialize method
m00p has left #ruby ["Leaving"]
Pumukel has quit [Ping timeout: 260 seconds]
<apeiros>
soulisson_: any other method which waits for the threads to complete. e.g. Thread#value
<soulisson_>
I'm playing with PacketFu, any one if it's ok to have multiple Capture instance?
<apeiros>
arquebus: that's not really what I asked. *with your current code* (which takes a hash in initialize), how do you create a celsius temperature (*without* the from_celsius method)
jgt1 has quit [Ping timeout: 258 seconds]
<soulisson_>
*know if ..
swills has quit [Quit: Leaving]
zeroDi has quit [Quit: WeeChat 1.5]
Pumukel has joined #ruby
<apeiros>
foxxx0: yes, along those lines. though you don't really need named args if you only take a single param (in initialize)
der-landgraf has quit [Ping timeout: 276 seconds]
<foxxx0>
apeiros: but i really like the params.fetch stuff for assigning default values if the key was not present in the params hash
<arquebus>
apeiros: as I said, I just have to create another if statement to deal with an another optional parameter, this time a numeric parameter instead of a hash, then set that to both @fahr and @cels instance variables like I did with the hash
LoneHerm_ has joined #ruby
<apeiros>
foxxx0: def initialize(temp=273.15) - you can have default values with positional args just fine.
<apeiros>
arquebus: seems to me you don't really understand your own code.
<foxxx0>
apeiros: but he already mentioned that initialize is going to be called with a hash argument later
<apeiros>
with the code you pasted, it'd be Temperature.new(c: 123) (where 123 is whichever temperature in celsius)
<apeiros>
no additional if needed. you already have one there.
<apeiros>
in my gist, temperature_proper.rb is how it IMO should have been done. temperature_expected.rb is how they (sadly) seem to expect it to be done. as said, IMO bad design.
anisha_ has joined #ruby
<foxxx0>
apeiros: not quite, the key for celsius on initialize is c:, not celsius:
<foxxx0>
apeiros: but yes, in general
<apeiros>
foxxx0: oh, right
<apeiros>
even worse
<foxxx0>
:D
bkxd has joined #ruby
roamingd_ has quit [Remote host closed the connection]
<apeiros>
wtf? I can't edit gists in the same session?
<foxxx0>
the assignment doesn't make much sense to me tbh
unreal has quit [Read error: Connection reset by peer]
<foxxx0>
apeiros: well, it's anonymous
<foxxx0>
apeiros: guess they are just readonly once uploaded
<foxxx0>
otherwise they would need to keep sessions for every anonymous user
unreal has joined #ruby
blackmesa has quit [Ping timeout: 258 seconds]
<apeiros>
no. they could let the browser keep the session.
<arquebus>
thanks all you guys, I learned a lot, I checked a lot of ruby books and found nothing so I would never have figured this out, thanks all, bye
beawesomeinstead has quit [Ping timeout: 252 seconds]
biberu has quit [Read error: Connection reset by peer]
<foxxx0>
well that was a weird dude
bkxd has quit [Ping timeout: 244 seconds]
<apeiros>
eh, just new to the whole stuff I guess
<apeiros>
we sometimes forget how weird all those things were when we started.
<foxxx0>
he seemed quite confused and couldn't even state his task at hand without causing further confusion
nadir has quit [Ping timeout: 250 seconds]
<foxxx0>
at least that what i felt
<apeiros>
yes. he had trouble understanding multiple aspects. but that's not uncommon when you're new.
<matthewd>
foxxx0: FWIW, we disagree on the source of the confusion
<foxxx0>
maybe i was the source? :>
roamingdog has joined #ruby
beawesomeinstead has joined #ruby
<matthewd>
That.. wasn't not my implication ;)
<foxxx0>
double negation, i see
nadir has joined #ruby
<matthewd>
Just at the start.. I felt like there was discussion on the reasonableness of the problem, which ended up confusing him about which advice to apply where, vs which parts were more... general observations
<foxxx0>
just to be clear: i'm mainly here to learn so just stop me whenever you feel the need to if i'm causing further confusion
AlexRussia has quit [Ping timeout: 258 seconds]
tvw has quit [Remote host closed the connection]
<apeiros>
hm, two sided sword. you also learn by trying to help. so stopping you from causing further confusion can also stop you from learning.
der-landgraf has joined #ruby
banisterfiend has joined #ruby
frozengeek has joined #ruby
<foxxx0>
stopping me from interfering doesn't mean i stop reading and following the conversation ;)
<apeiros>
sure. but it stops you from trying to help :)
<foxxx0>
not necessarily
anisha_ has quit [Ping timeout: 240 seconds]
<foxxx0>
i already had given up on that guy at one point but once it was finally clear what he was supposed to to / what the assignment was, i started fiddling on my own
<foxxx0>
maybe we could have reached that clarification a bit sooner if i hadn't caused further confusion :S
nankyokusei has joined #ruby
<foxxx0>
anyway, what i'm trying to say: i
<foxxx0>
i'm always open for feedback
edwardly has quit [Max SendQ exceeded]
edwardly has joined #ruby
edwardly has quit [Changing host]
edwardly has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
nankyokusei has quit [Ping timeout: 258 seconds]
kobain has joined #ruby
kobain has quit [Excess Flood]
symm- has joined #ruby
kobain has joined #ruby
<apeiros>
oh dear… I made a grave mistake. - and + are wrong in some places.
Burgestrand has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
blackmesa has joined #ruby
pokalyis has quit [Read error: Connection reset by peer]
bkxd has joined #ruby
MissionCritical has joined #ruby
pokalyis has joined #ruby
<soulisson_>
Are Ruby lists thread safe?
<matthewd>
soulisson_: Assuming you mean arrays... on MRI: yes, for some values of thread safe. In general / on other interpreters: no.
<soulisson_>
Main Ruby Interpreter?
bkxd has quit [Ping timeout: 258 seconds]
blackmesa has quit [Ping timeout: 258 seconds]
nando293921 has quit [Ping timeout: 276 seconds]
nebben has joined #ruby
KaliLinuxGR has quit [Read error: Connection reset by peer]
<yorickpeterse>
soulisson_: No.
<yorickpeterse>
Array, Hash, Set, etc, are not thread-safe
KaliLinuxGR has joined #ruby
<yorickpeterse>
Queue is pretty much the only collection data structure that is
<soulisson_>
ok
<yorickpeterse>
While the GIL will prevent two Ruby threads from running in parallel, the structures _themselves_ are not thread-safe
<apeiros>
given that Queue is now Thread::Queue - stuff within the Thread namespace is thread safe. anything which doesn't explicitly state to be thread safe is usually not.
aries_liuxueyang has quit [Ping timeout: 240 seconds]
anuxivm has joined #ruby
ellistaa has quit [Quit: ellistaa]
dhamidi has quit [Ping timeout: 258 seconds]
soulisson__ has joined #ruby
aries_liuxueyang has joined #ruby
soulisson_ has quit [Ping timeout: 252 seconds]
yfeldblu_ has quit [Ping timeout: 250 seconds]
<soulisson__>
Does Ruby have multiprocessing like Python?
maloik has quit [Remote host closed the connection]
maloik has joined #ruby
<matthewd>
soulisson__: I don't know of a library that does that.. though the relevant parts are there, so it's entirely possible someone has put them together
<apeiros>
parallelism isn't a language property. it's a runtime property.
<apeiros>
mri has concurrency but no parallelism (due to the GIL)