spider-mario has quit [Remote host closed the connection]
<shevy>
SweetSoulBro hey man how do you do
DEA7TH has quit [Quit: DEA7TH]
<SweetSoulBro>
I'm frustrated. Can someone take a look at some code I'm doing and tell me 1. What I'm doing wrong and 2. How to do what I want to do?
mwlang has joined #ruby
pullcheezy has joined #ruby
RegulationD has quit [Ping timeout: 244 seconds]
rgtk has quit [Remote host closed the connection]
<mwlang>
what exactly does ASLDotNetHandler do for SOAP4R?
startupality has quit [Quit: startupality]
<shevy>
SweetSoulBro the best you can do is put code onto a pastie like gist.github and link to #ruby so that someone can look at the code, ideally also write in that pastie what does not work exactly
<Radar>
SweetSoulBro: There are some people who know Ruby here.
<shevy>
you probably have a string somewhere there rather than an integer
Jardayn has joined #ruby
baweaver has joined #ruby
mag42c has quit [Quit: mag42c]
<SweetSoulBro>
?
<SweetSoulBro>
Where, in the get_heat?
asianMike has joined #ruby
devoldmx has quit [Ping timeout: 265 seconds]
sankaber has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
craysiii has quit [Quit: Leaving.]
<shevy>
nah, get_heat will return only numbers
<shevy>
I don't know how you get to that undefined method part, but evidently you can not have a number as it would work otherwise, ^^^ see what ruboto returned
x-light has quit [Ping timeout: 250 seconds]
Nahra has quit [Ping timeout: 250 seconds]
<shevy>
look at the line where it occurs, the ruby parser should tell you which line it is
Nahra` has joined #ruby
mic_e has quit [Ping timeout: 250 seconds]
daed has quit [Ping timeout: 250 seconds]
miah has quit [Ping timeout: 250 seconds]
<SweetSoulBro>
C:/users/ORIGIAN/Dropbox/gunbot/plasmahandgunclass.rb:61:in `get_wattage': undef ined method `-' for nil:NilClass (NoMethodError)
<SweetSoulBro>
That's the error I get.
<shevy>
aha
sankaber has joined #ruby
<shevy>
so you have a nil object
<shevy>
but all those @size = nil into def initialize
rgtk has quit [Ping timeout: 260 seconds]
mic_e has joined #ruby
<shevy>
and ensure that @heat has a proper value or whatever variables are used on line 61
n008f4g_ has quit [Ping timeout: 272 seconds]
daed has joined #ruby
miah has joined #ruby
diego1 has quit [Changing host]
diego1 has joined #ruby
<SweetSoulBro>
I did.
<SweetSoulBro>
Heat has a varible of 0
<shevy>
ok so if @heat would be 0, then any - 5 number deduction would work, so it would be -5 then
<SweetSoulBro>
Yes
<SweetSoulBro>
But it isn't.
kriskropd_ has joined #ruby
<SweetSoulBro>
I think it's saying the - is undefined.
<SweetSoulBro>
which..is even odder.
<shevy>
you have some nil object there
rgtk has joined #ruby
keen____________ has joined #ruby
<SweetSoulBro>
In wattage?
<SweetSoulBro>
Wattage is nil
<shevy>
I don't know where you have it
<shevy>
to be honest, your code is not the cleanest right now ;)
eminencehc has quit [Remote host closed the connection]
<shevy>
can you try to redo the class, but add variables only step-by-step?
aspiers has joined #ruby
keen___________ has quit [Ping timeout: 244 seconds]
<shevy>
like start with @heat and ensure that it works; you can use pp to inspect; require 'pp' at the top
__main__ has quit [Remote host closed the connection]
<SweetSoulBro>
What?
<SweetSoulBro>
I know it works.
<SweetSoulBro>
It works when it picks one that doesn't subtract from heat
<SweetSoulBro>
I tested that
sankaber has quit [Ping timeout: 272 seconds]
<shevy>
ah
atomical has joined #ruby
<shevy>
you use get_wattage
__main__ has joined #ruby
<shevy>
but get_wattage can return either a String or a Number right?
<shevy>
hmm and perhaps nil too
<SweetSoulBro>
It should return a string
<SweetSoulBro>
What I'm trying to do
<SweetSoulBro>
is after it returns that string
<shevy>
ok so you are sure that it should return a string
<shevy>
but there are cases where it will not
<SweetSoulBro>
execute that math problem.
<shevy>
for instance, you use: @heat = @heat - 6
rbennacer has quit [Remote host closed the connection]
<shevy>
and if @heat is a number, it will return that number
rshetty has joined #ruby
<shevy>
and in the line above, you use: "15 kW(1d8)"
<baweaver>
-=
<shevy>
so it will return a String
tkuchiki has joined #ruby
<SweetSoulBro>
Yes
nizmow has quit [Ping timeout: 256 seconds]
dfockler has quit [Ping timeout: 244 seconds]
rgtk has quit [Ping timeout: 260 seconds]
beauby has joined #ruby
<shevy>
ruby will return the last statement of a method if you omit return keyword
<SweetSoulBro>
...huh
<SweetSoulBro>
SO it's upside down?
chipotle has joined #ruby
<shevy>
well
<shevy>
take those two lines here:
<shevy>
"35 kW(2d8)"
<shevy>
@heat = @heat - 6
<shevy>
simply switch them
<shevy>
@heat = @heat - 6
<shevy>
"35 kW(2d8)"
<SweetSoulBro>
..ok
<shevy>
everywhere you use them and it should work, or at the least be consistent with the rest of your if/else clauses
<SweetSoulBro>
Mmhm
sepp2k1 has quit [Read error: Connection reset by peer]
<SweetSoulBro>
Nope.
<SweetSoulBro>
still crashed.
sankaber has joined #ruby
rshetty has quit [Ping timeout: 240 seconds]
senayar has joined #ruby
senayar has joined #ruby
tkuchiki has quit [Remote host closed the connection]
arooni has joined #ruby
diego1 is now known as diegoviola
sankaber has quit [Client Quit]
yfeldblum has quit [Remote host closed the connection]
eminencehc has quit [Remote host closed the connection]
eminencehc has joined #ruby
Laaw has quit [Max SendQ exceeded]
<havenwood>
adm001mi: Ah, so you have a Ruby selected with RVM but it looks like /usr/bin/ is ahead of RVM in your PATH.
rgtk has quit [Read error: No route to host]
<havenwood>
adm001mi: echo $PATH
rgtk has joined #ruby
_djbkd has quit [Remote host closed the connection]
Laaw has joined #ruby
rgtk has quit [Read error: No route to host]
_djbkd has joined #ruby
<havenwood>
adm001mi: If it was as RVM wanted it it would start with something like: "/home/adm001mi/.gem/ruby/2.1.5/bin:/home/adm001mi/.rubies/ruby-2.1.5/lib/ruby/gems/2.1.0/bin:..."
eminencehc has quit [Remote host closed the connection]
<adm001mi>
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" >> ~/.bashrc is what I apparently use...
senayar has quit []
eminencehc has joined #ruby
rgtk has quit [Read error: No route to host]
<TheNet>
stack overflow is down :o
bryanray has joined #ruby
rgtk has joined #ruby
<havenwood>
adm001mi: Let's go to RVM to get it working. It's shell at this point.
<havenwood>
adm001mi: The #rvm channel I mean.
<adm001mi>
havenwood: aight, thx so far
zenguy_pc has joined #ruby
<havenwood>
adm001mi: np
RobertBirnie has joined #ruby
rgtk has quit [Read error: Connection reset by peer]
rgtk has joined #ruby
mikeharris22 has joined #ruby
_djbkd has quit [Ping timeout: 265 seconds]
swgillespie is now known as swgillespie[GT]
rgtk has quit [Read error: Connection reset by peer]
favadi has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
northfurr has quit [Quit: northfurr]
rgtk has joined #ruby
northfurr has joined #ruby
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
JDiPierro has joined #ruby
RobertBirnie has quit [Client Quit]
bruno- has joined #ruby
juanpablo__ has joined #ruby
rgtk has quit [Read error: Connection reset by peer]
Rinzlit has joined #ruby
rgtk has joined #ruby
arescorpio has joined #ruby
ibouvousaime has quit [Ping timeout: 252 seconds]
mikeharris22 has quit [Ping timeout: 260 seconds]
rgtk has quit [Read error: Connection reset by peer]
finisherr has joined #ruby
Musashi007 has quit [Quit: Musashi007]
Rinzlit_ has quit [Ping timeout: 246 seconds]
rgtk has joined #ruby
maletor has joined #ruby
leat has joined #ruby
Rollabunna has joined #ruby
kies^ has joined #ruby
northfurr has quit [Client Quit]
l_tonz has quit [Remote host closed the connection]
rgtk has quit [Read error: No route to host]
Coldblackice has joined #ruby
duckpuppy has joined #ruby
rgtk has joined #ruby
juanpablo__ has quit [Ping timeout: 265 seconds]
bruno- has quit [Ping timeout: 265 seconds]
sidearmsplit has joined #ruby
allcentury has joined #ruby
rgtk has quit [Read error: No route to host]
sanjayu has quit [Ping timeout: 256 seconds]
rgtk has joined #ruby
<sidearmsplit>
Hello ! can anyone point me to docs on what Foo.new({->var}) would do? I’m mainly curious about what the curly braces inside the new method and -> do with var
<sidearmsplit>
I can’t find anything about it in the Class docs
roxtrongo has joined #ruby
tmtwd has joined #ruby
rgtk has quit [Read error: No route to host]
Rollabunna has quit [Ping timeout: 260 seconds]
rgtk has joined #ruby
aspiers has quit [Ping timeout: 264 seconds]
duckpuppy has quit [Ping timeout: 252 seconds]
rgtk has quit [Read error: No route to host]
shadoi has quit [Quit: Leaving.]
rgtk has joined #ruby
rgtk has quit [Read error: No route to host]
rgtk has joined #ruby
rgtk has quit [Read error: No route to host]
rgtk has joined #ruby
bruce_lee2 has quit [Changing host]
bruce_lee2 has joined #ruby
Musashi007 has joined #ruby
pdoherty has joined #ruby
pdoherty has quit [Read error: Connection reset by peer]
rgtk has quit [Read error: No route to host]
ESpiney has joined #ruby
rgtk has joined #ruby
JDiPierro has quit [Remote host closed the connection]
rgtk has quit [Read error: No route to host]
tenzan has joined #ruby
rgtk has joined #ruby
chipotle has joined #ruby
tenzan has quit [Client Quit]
pdoherty has joined #ruby
tenzan has joined #ruby
rgtk has quit [Read error: No route to host]
rgtk has joined #ruby
devoldmx has joined #ruby
rgtk has quit [Read error: No route to host]
bryanray has quit [Read error: Connection reset by peer]
rgtk has joined #ruby
northfurr has joined #ruby
rehat has joined #ruby
rgtk has quit [Read error: No route to host]
rgtk has joined #ruby
NeverDie_ is now known as NeverDie
devoldmx has quit [Ping timeout: 240 seconds]
rgtk has quit [Read error: No route to host]
duckpuppy has joined #ruby
rgtk has joined #ruby
_djbkd has joined #ruby
sankaber has joined #ruby
s00pcan has quit [Remote host closed the connection]
sankaber has quit [Remote host closed the connection]
Heero has joined #ruby
joaomdmoura has joined #ruby
sankaber has joined #ruby
kalzz has joined #ruby
rgtk has joined #ruby
zemmihates has joined #ruby
dukedave has joined #ruby
Anthony_ has joined #ruby
holsee_ has joined #ruby
knowtheory has joined #ruby
golgaroth has joined #ruby
frode15243 has joined #ruby
mostlybadfly has joined #ruby
jxf has joined #ruby
_blizzy_ has quit [Disconnected by services]
Anthony_ is now known as _blizzy_
<shevy>
sidearmsplit faded away ... another webchatter bites the dust
specialblend has joined #ruby
RegulationD has quit [Ping timeout: 264 seconds]
Motoservo has joined #ruby
rgtk_ has joined #ruby
glowcoil has joined #ruby
rgtk has quit [Ping timeout: 260 seconds]
l_tonz has joined #ruby
vdamewood has joined #ruby
duncannz has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
rgtk_ has quit [Read error: No route to host]
rgtk has joined #ruby
zenguy_pc has joined #ruby
solocshaw has quit [Ping timeout: 272 seconds]
<jeffreylevesque>
anyone here use ruby linting?
Musashi007 has joined #ruby
dopie has joined #ruby
l_tonz has quit [Ping timeout: 272 seconds]
kalz has joined #ruby
yfeldblum has quit [Remote host closed the connection]
bryanray has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
allcentury has quit [Ping timeout: 255 seconds]
yfeldblum has joined #ruby
TheNet has quit [Remote host closed the connection]
c355E3B has quit [Quit: Connection closed for inactivity]
rgtk has quit [Ping timeout: 260 seconds]
TheNet has joined #ruby
dorei has quit []
mallu has joined #ruby
solenoids has quit [Ping timeout: 256 seconds]
<mallu>
I have simple values ["a", "c", "f']. How do I sort it?
l_tonz has joined #ruby
pathrocl_ has quit [Remote host closed the connection]
tlaxkit has quit [Quit: ¡Hasta luego!]
keen___________0 has joined #ruby
jaequery has joined #ruby
<Radar>
mallu: what did you try?
FungalRaincloud has joined #ruby
jordanm has quit [Read error: Connection reset by peer]
freerobby has quit [Quit: Leaving.]
mwlang has quit [Quit: mwlang]
keen____________ has quit [Ping timeout: 255 seconds]
bryanray has joined #ruby
Musashi007 has quit [Quit: Musashi007]
x-light has quit [Ping timeout: 255 seconds]
linduxed has quit [Ping timeout: 255 seconds]
TheNet has quit [Remote host closed the connection]
juanpablo__ has joined #ruby
roxtrongo has quit [Remote host closed the connection]
jonee has quit [Ping timeout: 265 seconds]
roxtrongo has joined #ruby
juanpablo__ has quit [Ping timeout: 264 seconds]
duckpuppy has joined #ruby
jpfuentes2 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
solenoids has joined #ruby
hightower2 has joined #ruby
<hightower2>
Hey, I run an irb session with IRB.start_no_setup. Before or after that, I would like to define a function which should be accessible from the IRB shell directly (without prefixing with module or class name). How would I do that?
rakm has joined #ruby
rakm has quit [Client Quit]
<hightower2>
Oh I see, it is executing in 'main', so I just def the function before calling start
TheNet has joined #ruby
Feyn has joined #ruby
duckpuppy has quit [Ping timeout: 264 seconds]
cmoney has joined #ruby
bryanray has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bryanray has joined #ruby
djbkd has quit [Remote host closed the connection]
djbkd has joined #ruby
<jaequery>
if i have an object, Something.name, how can i call it this way, Something.call(some_variable) , where some_variable is "name"
<Radar>
jaequery: Something.send(some_variable)
sankaber has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jonee has joined #ruby
mwlang has joined #ruby
jcdenton has joined #ruby
tjbiddle has quit [Ping timeout: 240 seconds]
l_tonz has quit [Remote host closed the connection]
tjbiddle has joined #ruby
<mallu>
Radar: for sorting I tried this File.open("/stack_names.json", "w") do |f|
<mallu>
f.write(stack_names.sort)
<mallu>
end
darkf has joined #ruby
<Radar>
mallu: We don't know what stack_names.json is.
<mallu>
but I am getting undefined method `sort' for #<String:0x000000013c94b0> (NoMethodError)
<mallu>
stack_names.json I want to create that file
asianMike has joined #ruby
linduxed has joined #ruby
<jcdenton>
stack_names is of type string ? which doesn't have a sort method?
<mallu>
I want to sort stack_names array and wrote that to /stack_names.json
gener1c_ has joined #ruby
<jcdenton>
it seem slike interpreter is telling you that stack_names is of type string
<jcdenton>
so error must before that line
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
tenzan has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
gener1c has quit [Ping timeout: 240 seconds]
freerobby has joined #ruby
slawrence00 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<mallu>
stack_name is a json !
<mallu>
so I need to sort it
braincrash has quit [Quit: bye bye]
bruno- has joined #ruby
sdothum has joined #ruby
Rollabunna has joined #ruby
benlieb has joined #ruby
jc036821 has joined #ruby
jc036821 has quit [Client Quit]
bruno- has quit [Ping timeout: 252 seconds]
RobertBirnie has joined #ruby
RobertBirnie has quit [Remote host closed the connection]
eminencehc has quit [Remote host closed the connection]
saddad has quit [Quit: WeeChat 1.4-dev]
CVTJNII has joined #ruby
freerobby has quit [Quit: Leaving.]
saddad has joined #ruby
linduxed has joined #ruby
i8igmac has quit [Ping timeout: 264 seconds]
duncannz has quit [Ping timeout: 256 seconds]
djbkd has quit [Quit: Leaving...]
joufflu has joined #ruby
graffix has joined #ruby
Feyn has quit [Read error: Connection reset by peer]
l_tonz has joined #ruby
vdamewood has quit [Quit: Life beckons.]
solocshaw has joined #ruby
saddad has quit [Quit: WeeChat 1.4-dev]
cmoney has quit [Remote host closed the connection]
specialblend has quit [Quit: specialblend]
devbug_ has joined #ruby
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
Feyn has joined #ruby
<graffix>
greetings
tenzan has joined #ruby
<blubjr>
hi graffix
shinenelson has joined #ruby
<graffix>
I am trying to setup the code here https://github.com/jeroenr/awection, I’m just trying to get it working locally in a vagrant vm, I have the server running, listening at port 4000, and I have the app running listening at port 3000
<graffix>
but when I try to connect to the app I get an error
devbug has quit [Ping timeout: 272 seconds]
<graffix>
undefined method `websocket_endpoint' for AuctionEngine::App:Class
<graffix>
I know absolutely nothing about ruby
<graffix>
I googled the error, but I can’t find anything relevant
bryanray has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
leafybasil has joined #ruby
arescorpio has quit [Quit: Leaving.]
<graffix>
it’s running on sinatra, with thin webserver
<graffix>
I see it’s giving me a method undefined error, but I’m not sure why it would be undefined, I pullled the code from github and followed all the instructions to get it running
allcentury has joined #ruby
leafybasil has quit [Ping timeout: 250 seconds]
moeabdol1 has joined #ruby
<finisherr>
If you call a bare method in a ruby program, what is the receiver of the method?
djbkd has joined #ruby
sdfgsdfg has joined #ruby
bruno- has joined #ruby
nemo_ has joined #ruby
zenguy_pc has quit [Ping timeout: 240 seconds]
bruno- has quit [Ping timeout: 260 seconds]
astrobunny has joined #ruby
manuelmesson has joined #ruby
RegulationD has joined #ruby
<graffix>
heck I don’t knwo, kind of why I was asking
tkuchiki has joined #ruby
d34th4ck3r has joined #ruby
shinnya has quit [Ping timeout: 264 seconds]
PaulCapestany has quit [Quit: .]
RegulationD has quit [Ping timeout: 265 seconds]
tkuchiki has quit [Ping timeout: 256 seconds]
PaulCapestany has joined #ruby
hxegon has quit [Ping timeout: 240 seconds]
Puffball has quit [Remote host closed the connection]
astrobunny has quit [Remote host closed the connection]
juanpablo__ has joined #ruby
terminalrecluse has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
zenguy_pc has joined #ruby
Puffball has joined #ruby
devbug_ has quit [Read error: Connection reset by peer]
ryanlntn has joined #ruby
devbug has joined #ruby
davedev24 has joined #ruby
tkuchiki has joined #ruby
nemo_ has quit [Remote host closed the connection]
ryanlntn has left #ruby [#ruby]
patdohere has joined #ruby
l_tonz has quit [Remote host closed the connection]
<graffix>
what would this denote inside of a erb template <%= websocket_endpoint %>?
jcdenton has quit [Ping timeout: 252 seconds]
juanpablo__ has quit [Ping timeout: 264 seconds]
manuelmesson has quit [Remote host closed the connection]
asianMike has quit [Remote host closed the connection]
jcdenton has joined #ruby
davedev24 has quit [Ping timeout: 246 seconds]
jcdenton has left #ruby [#ruby]
l_tonz has joined #ruby
favadi has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
arup_r has joined #ruby
<havenwood>
finisherr: self
djbkd has quit [Remote host closed the connection]
nemo_ has joined #ruby
<havenwood>
finisherr: which is "main" at top level
EmeraldExplorer has quit [Quit: Connection closed for inactivity]
timonv has joined #ruby
VeryBewitching has quit [Quit: Konversation terminated!]
d34th4ck3r has quit [Quit: zzz]
ruurd has joined #ruby
RegulationD has quit [Ping timeout: 240 seconds]
yes`r has joined #ruby
ruurd has quit [Ping timeout: 246 seconds]
User458764 has joined #ruby
dionysus69 has joined #ruby
<norc>
apeiros: Ah that makes sense.
krz has joined #ruby
i8igmac has quit [Ping timeout: 255 seconds]
i8igmac has joined #ruby
PaulCape_ has joined #ruby
SOLDIERz has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
howdoi has joined #ruby
PaulCapestany has quit [Ping timeout: 260 seconds]
nemo_ has quit [Remote host closed the connection]
kies^ has quit [Ping timeout: 250 seconds]
dionysus69 has quit [Ping timeout: 240 seconds]
blue_deref has quit [Quit: bbn]
moeabdol1 has quit [Ping timeout: 252 seconds]
nemo_ has joined #ruby
codecop has joined #ruby
duckpuppy has joined #ruby
kies^ has joined #ruby
Guest37565 has quit [Ping timeout: 240 seconds]
hightower2 has quit [Ping timeout: 268 seconds]
d34th4ck3r has joined #ruby
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rehat has quit [Remote host closed the connection]
bigkevmcd has joined #ruby
bMalum has joined #ruby
sanjayu has joined #ruby
tlarevo has quit [Ping timeout: 268 seconds]
allomov has joined #ruby
quazimodo has quit [Ping timeout: 240 seconds]
tlarevo has joined #ruby
kies^ has quit [Remote host closed the connection]
kimegede has joined #ruby
tlarevo_ has joined #ruby
tlarevo has quit [Read error: Connection reset by peer]
arooni has quit [Ping timeout: 246 seconds]
tlarevo_ has quit [Ping timeout: 250 seconds]
htmldrum has joined #ruby
tlarevo has joined #ruby
karapetyan has joined #ruby
shinnya has joined #ruby
<naftilos76>
Is there a way to force strings that rails retrieves from the db to utf8 in order to avoid issues with non-english chars in a global scale? I tried in /config/application.rb to add the line config.encoding = "utf-8" but it did not make any difference. The only solution that works iss to use string.force_encoding(Encoding::UTF_8) . Does anybody have anything else to suggest?
benlieb has quit [Quit: benlieb]
tlarevo has quit [Ping timeout: 246 seconds]
devbug has quit [Read error: Connection reset by peer]
tlarevo has joined #ruby
michae has left #ruby ["WeeChat 1.1.1"]
agit0 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
zenguy_pc has quit [Ping timeout: 240 seconds]
nemo_ has quit [Remote host closed the connection]
Asher has quit [Quit: Leaving.]
Asher has joined #ruby
TomyWork has joined #ruby
arooni has joined #ruby
SCHAAP137 has joined #ruby
<blubjr>
how do i check if a predicate returns true for every element in a sequence
DoubleMalt has joined #ruby
<blubjr>
like every in lisp
kimegede has quit [Quit: Leaving...]
dikaio has joined #ruby
roxtrongo has joined #ruby
<djellemah>
blubjr: Array#all?
Musashi007 has quit [Quit: Musashi007]
<norc>
naftilos76: I recommend you try asking in #rubyonrails since I suspect this to be ActiveRecord specific.
<blubjr>
yes thank you
l_tonz has joined #ruby
Rollabunna has joined #ruby
moeabdol1 has joined #ruby
bruno- has joined #ruby
nfk|laptop has joined #ruby
baweaver has quit [Remote host closed the connection]
dionysus69 has joined #ruby
al2o3-cr has quit [Ping timeout: 256 seconds]
aufi has joined #ruby
zenguy_pc has joined #ruby
stan has joined #ruby
Rollabunna has quit [Ping timeout: 265 seconds]
l_tonz has quit [Ping timeout: 260 seconds]
bruno- has quit [Ping timeout: 265 seconds]
leafybasil has joined #ruby
purplexed- has quit [Ping timeout: 264 seconds]
Timba-as has joined #ruby
al2o3-cr has joined #ruby
leafybasil has quit [Ping timeout: 250 seconds]
nemo_ has joined #ruby
allomov has quit [Remote host closed the connection]
chipotle has quit [Ping timeout: 244 seconds]
kobain has quit [Ping timeout: 252 seconds]
karapetyan has quit [Remote host closed the connection]
platzhirsch has joined #ruby
karapetyan has joined #ruby
ahegyi has quit [Ping timeout: 246 seconds]
karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
Rollabunna has joined #ruby
nhhagen has joined #ruby
stardiviner has joined #ruby
Voker57 has joined #ruby
hxegon has quit [Ping timeout: 244 seconds]
matcouto has joined #ruby
Olipro- has joined #ruby
Olipro- is now known as Guest23333
al2o3-cr has quit [Ping timeout: 256 seconds]
al2o3-cr has joined #ruby
agit0 has joined #ruby
charliesome has joined #ruby
everbot has joined #ruby
solars has joined #ruby
Rollabunna has quit [Remote host closed the connection]
Rollabunna has joined #ruby
charliesome has quit [Client Quit]
arooni has quit [Ping timeout: 246 seconds]
DoubleMalt has quit [Remote host closed the connection]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
aspiers has quit [Ping timeout: 252 seconds]
patdohere has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
stamina has joined #ruby
Rollabunna has quit [Ping timeout: 264 seconds]
timonv has quit [Ping timeout: 240 seconds]
p1k has quit [Quit: Leaving]
chipotle has joined #ruby
johnny56 has quit [Quit: WeeChat 1.4-dev]
Pathfinder has joined #ruby
johnny56 has joined #ruby
yfeldblum has joined #ruby
Ulfalizer has quit [Read error: No route to host]
hughjasss has joined #ruby
joonty has joined #ruby
marr has joined #ruby
User458764 has joined #ruby
senayar has joined #ruby
huwjass has quit [Ping timeout: 252 seconds]
arup_r has joined #ruby
Musashi007 has joined #ruby
techsethi has joined #ruby
ocx has joined #ruby
<ocx>
hello, how can i receive an argument/parameter from a websocket request?
jimms has quit [Remote host closed the connection]
finisherr has quit [Quit: finisherr]
arup_r has quit [Max SendQ exceeded]
arup_r has joined #ruby
jimms has joined #ruby
finisherr has joined #ruby
arup_r has quit [Max SendQ exceeded]
arup_r has joined #ruby
arup_r has quit [Max SendQ exceeded]
arup_r has joined #ruby
Cyther has joined #ruby
arup_r has quit [Max SendQ exceeded]
<ocx>
anyopne?
<apeiros>
ocx: I don't even know where to start at how much context you left out
arup_r has joined #ruby
<ocx>
apeiros: i am sending from javascript a websocket request with some data, want to read that data in sinatra
devoldmx has quit [Remote host closed the connection]
<apeiros>
then you probably want to ask your question in #sinatra
quazimodo has quit [Read error: Connection reset by peer]
pandaant has joined #ruby
zenguy_pc has joined #ruby
spider-mario has joined #ruby
dionysus69 has quit [Ping timeout: 264 seconds]
catphish has joined #ruby
dionysus69 has joined #ruby
User458764 has quit [Ping timeout: 255 seconds]
krz has quit [Quit: WeeChat 1.2]
bruno- has joined #ruby
haxrbyte_ has quit [Read error: Connection reset by peer]
jonee has joined #ruby
haxrbyte has joined #ruby
Rickmasta has joined #ruby
nhhagen has quit [Remote host closed the connection]
timonv has joined #ruby
platzhirsch has left #ruby [#ruby]
bruno- has quit [Ping timeout: 256 seconds]
dionysus69 has quit [Remote host closed the connection]
hughjasss has quit [Ping timeout: 255 seconds]
rgtk has quit [Remote host closed the connection]
minimalism has quit [Quit: leaving]
techsethi has quit [Quit: techsethi]
Guest34849 has joined #ruby
Guest34849 is now known as pard
<pard>
greetin's
<blubjr>
hi pard
DEA7TH has quit [Quit: DEA7TH]
<pard>
:)
c355E3B has joined #ruby
techsethi has joined #ruby
minimalism has joined #ruby
DEA7TH has joined #ruby
ldnunes has joined #ruby
<apeiros>
pard: you do know that replacing "g" with "'" is not really english?
<pard>
does "require"ng a module pollute the scope it was imported in?
<apeiros>
you can't require modules. require is file based.
DEA7TH has quit [Client Quit]
<apeiros>
and the required file can add stuff wherever it wants, so yes, it can pollute existing scopes.
<pard>
thanks
codecop has quit [Remote host closed the connection]
<pard>
are there any measures that can be taken so it won't happen?
<pard>
ok , accept my apologies; i will use the correct spelling
<apeiros>
no sensible ones IMO
niemcu has joined #ruby
<apeiros>
you can freeze a module. that'll prevent adding anything to it.
<pard>
thanks a lot
<pard>
so with every require a potential pollution entails
Coraline has quit [Ping timeout: 255 seconds]
haxrbyte_ has joined #ruby
hmsimha_ has quit [Ping timeout: 265 seconds]
chrislotix has joined #ruby
Alina-malina has joined #ruby
<pard>
i have another thing to ask; is this a correct piece of code: class L; include module; def l() 12 end end end
bruno- has joined #ruby
<pard>
?
<pard>
i mean, is "modul" an obj actually?
vigintas has quit [Ping timeout: 268 seconds]
<apeiros>
it's a local variable or method. since you opened a new lvar scope (class) and didn't assign to module, it can only be a method. so if the L.module exists and returns a Module, the code can work.
<apeiros>
otherwise it's a NoMethodError
haxrbyte has quit [Ping timeout: 256 seconds]
<apeiros>
or in case of L.module not returning a Module, it's a TypeError
vigintas has joined #ruby
vigintas has quit [Remote host closed the connection]
vigintas has joined #ruby
petersaints has quit [Quit: I'll be back!]
<pard>
thanks a lot
<pard>
i doubt if so much knowledge has been gaind through mere experience :)
x-light has joined #ruby
platzhirsch has joined #ruby
Skruff has joined #ruby
Skruff has left #ruby [#ruby]
marr has quit [Ping timeout: 250 seconds]
hiyosi has joined #ruby
but3k4 has joined #ruby
trautwein has quit [Ping timeout: 265 seconds]
rgtk has joined #ruby
nemo_ has quit [Remote host closed the connection]
trautwein has joined #ruby
juanpablo__ has joined #ruby
mistermocha has joined #ruby
pard has quit [Quit: Leaving]
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
quazimodo has joined #ruby
dionysus69 has joined #ruby
rgtk has quit [Remote host closed the connection]
moty66_ has quit [Read error: Connection reset by peer]
leafybasil has joined #ruby
pathrocle has joined #ruby
juanpablo__ has quit [Ping timeout: 256 seconds]
trautwein has quit [Ping timeout: 255 seconds]
lxsameer has quit [Ping timeout: 244 seconds]
trautwein has joined #ruby
lxsameer has joined #ruby
lxsameer has joined #ruby
lxsameer has quit [Changing host]
mistermocha has quit [Ping timeout: 246 seconds]
nemo_ has joined #ruby
duckpuppy has joined #ruby
kay_ has joined #ruby
Igorshp has joined #ruby
x-light has quit [Ping timeout: 264 seconds]
rgtk has joined #ruby
trautwei_ has joined #ruby
trautwein has quit [Ping timeout: 240 seconds]
nhhagen has joined #ruby
duckpuppy has quit [Ping timeout: 260 seconds]
SylarRuby has quit [Remote host closed the connection]
gregoriokusowski has joined #ruby
aevitas has joined #ruby
Musashi007 has quit [Quit: Musashi007]
arthurix_ has quit [Read error: Connection reset by peer]
arthurix has joined #ruby
dionysus69 has quit [Quit: dionysus69]
Luming has joined #ruby
arup_r has joined #ruby
trautwein has joined #ruby
K1MOS has joined #ruby
dionysus69 has joined #ruby
arup_r has quit [Max SendQ exceeded]
arup_r has joined #ruby
ibouvousaime has joined #ruby
nemo__ has joined #ruby
arup_r has quit [Max SendQ exceeded]
arup_r has joined #ruby
trautwei_ has quit [Ping timeout: 250 seconds]
arup_r has quit [Max SendQ exceeded]
arup_r has joined #ruby
nemo_ has quit [Ping timeout: 252 seconds]
moeabdol1 has quit [Ping timeout: 246 seconds]
workmad3 has quit [Quit: leaving]
BadRobot has quit [Ping timeout: 246 seconds]
beast has joined #ruby
arup_r has quit [Max SendQ exceeded]
Rickmasta has joined #ruby
arup_r has joined #ruby
arup_r has quit [Max SendQ exceeded]
allomov has joined #ruby
allomov_ has joined #ruby
allomov has quit [Read error: Connection reset by peer]
RegulationD has joined #ruby
arup_r has joined #ruby
arup_r has quit [Max SendQ exceeded]
arup_r has joined #ruby
skinux has joined #ruby
chipotle has quit [Quit: cheerio]
<skinux>
part
skinux has left #ruby [#ruby]
jeffreylevesque_ has joined #ruby
jeffreylevesque has quit [Ping timeout: 240 seconds]
darkf_ has joined #ruby
RegulationD has quit [Ping timeout: 246 seconds]
arup_r has quit [Client Quit]
favadi has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
senayar has quit [Read error: Connection reset by peer]
senayar has joined #ruby
senayar has quit [Changing host]
senayar has joined #ruby
darkf has quit [Ping timeout: 240 seconds]
fbidu has joined #ruby
nemo_ has joined #ruby
rgtk has quit [Remote host closed the connection]
jeffreylevesque_ has quit [Ping timeout: 246 seconds]
nemo__ has quit [Ping timeout: 255 seconds]
beauby has joined #ruby
jonee has quit [Ping timeout: 240 seconds]
startupality has quit [Quit: startupality]
dionysus69 has quit [Quit: dionysus69]
n has joined #ruby
n is now known as Guest68442
Guest68442 is now known as pard
moeabdol1 has joined #ruby
pard has left #ruby [#ruby]
pard has joined #ruby
<pard>
salutes
<pard>
is there any site describing the ayout of the outpt Ripper produces?
<pard>
*l
charliesome has joined #ruby
<pard>
i'm baffled by all "nil" things it emits
sgambino has joined #ruby
kay_ has left #ruby [#ruby]
but3k4 has quit [Read error: Connection reset by peer]
nhhagen has quit [Remote host closed the connection]
y0da has joined #ruby
bMalum has quit [Read error: Connection reset by peer]
nhhagen has joined #ruby
nhhagen has quit [Remote host closed the connection]
nhhagen has joined #ruby
syath has joined #ruby
arup_r has joined #ruby
senayar has quit [Remote host closed the connection]
but3k4 has joined #ruby
favadi has joined #ruby
bMalum has joined #ruby
y0da has quit [Read error: Connection reset by peer]
cornerma1 has joined #ruby
senayar has joined #ruby
catonearth has joined #ruby
kikia has joined #ruby
JDiPierro has joined #ruby
cornerman has quit [Ping timeout: 268 seconds]
cornerma1 is now known as cornerman
<yorickpeterse>
pard: don't bother using Ripper, it's terrible
<yorickpeterse>
it actually works across all implementations, and does so nicely
prestorium has joined #ruby
pepperbreath1 has joined #ruby
pepperbreath1 has left #ruby [#ruby]
tulak has joined #ruby
kikia has quit [Ping timeout: 244 seconds]
ErhardtMundt has joined #ruby
marr has joined #ruby
wlanboy has quit [Ping timeout: 250 seconds]
catonearth has quit [Quit: Leaving]
lostduck has left #ruby [#ruby]
<pard>
yorickpeterse, thanks
sdothum has joined #ruby
<pard>
yorickpeterse, i can't help wondering still, what all the trailng "nil" in its produced arrays mean :\
DEA7TH has joined #ruby
juanpablo__ has joined #ruby
VeinMelted has joined #ruby
VeinMelted has quit [Remote host closed the connection]
VeinMelted has joined #ruby
pcw888 has joined #ruby
wlanboy has joined #ruby
wlanboy has joined #ruby
d34th4ck3r has quit [Quit: zzz]
<yorickpeterse>
Those are just placeholders for nodes that are optional
<pard>
thanks
favadi has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
TvL2386 has joined #ruby
fbidu has quit [Ping timeout: 240 seconds]
Icey has quit [Remote host closed the connection]
<pard>
wait -- the creators list says you are its dev!
<pard>
i'm honor'd
juanpablo__ has quit [Ping timeout: 240 seconds]
jonee has joined #ruby
<pard>
yorickpeterse, may i ask you a few things through private messagng?
<pard>
or is it cool to ask it on the channel?
<darix>
pard: ask in channel
<pard>
thanks
<pard>
i reckon making a Parser calls for huge expertise
northfurr has joined #ruby
Azure has quit [Read error: Connection reset by peer]
JDiPierro has quit [Remote host closed the connection]
dionysus69 has joined #ruby
<pard>
i want to ask where have you acquird such expertise from
<pard>
thanks
spider-mario has quit [Ping timeout: 240 seconds]
Icey has joined #ruby
nemo__ has joined #ruby
dionysus69 has quit [Remote host closed the connection]
<pard>
(it is more of a Parser question, which is the reason i thought i should ask it off-channel)
nemo_ has quit [Ping timeout: 256 seconds]
devoldmx has joined #ruby
aevitas has quit [Remote host closed the connection]
darkf_ is now known as darkf
Azure has joined #ruby
zenguy_pc has quit [Ping timeout: 246 seconds]
arup_r has quit [Quit: Leaving]
VeinMelted has quit [Ping timeout: 255 seconds]
techsethi has quit [Quit: techsethi]
Pumukel has joined #ruby
agm has joined #ruby
agm has left #ruby ["Leaving"]
yfeldblum has quit [Ping timeout: 240 seconds]
Quandl has joined #ruby
devoldmx has quit [Ping timeout: 256 seconds]
<chrislotix>
I've got a question: Why do i get rb:12 undefined method 'chomp' for nil:NilClass(No method error)? Even when i explicitly printed that object's class it said its "File" What gives? Gist: https://gist.github.com/chrislotix/f90a50c41d0b0030e41f
Quandl is now known as Yiota
krz has joined #ruby
allomov_ has quit [Remote host closed the connection]
AlexRussia has joined #ruby
DEA7TH has quit [Quit: DEA7TH]
<mblagden>
chrislotix: what did you identify as a file? "f" or the result of "f.gets" ?
<mblagden>
because you call chomp on the result of "f.gets"...
<chrislotix>
i just double checked and called it on f
charliesome has quit [Read error: Connection reset by peer]
jinie has quit [Ping timeout: 268 seconds]
<chrislotix>
now i checked it on f.gets and it's indeed Nil, how come?
tlarevo has quit [Remote host closed the connection]
pard has quit [Quit: Leaving]
tlarevo has joined #ruby
jinie has joined #ruby
skweek has quit [Ping timeout: 246 seconds]
<chrislotix>
My ruby -v is 2.1.5
htmldrum has quit [Ping timeout: 265 seconds]
nemo_ has joined #ruby
charliesome has joined #ruby
<mblagden>
check out the possibilities for when gets will return nil: ruby-doc.org/core-2.2.3/IO.html
<gregf_>
charliesome: you need to check for eof?
uber has quit [Remote host closed the connection]
<gregf_>
that file handle returns null somewhere down the line. like so, current_file = open("foo.txt");while ( !current_file.eof); p current_file.gets.chomp;end
skweek has joined #ruby
hindenbug has joined #ruby
synthroid has joined #ruby
pcw888 has quit [Quit: Leaving.]
hindenbug has quit [Remote host closed the connection]
<gregf_>
charliesome: to get your error, try this: current_file = open("foo.txt");while (1 ); p current_file.gets.chomp;en
<gregf_>
s/$/d/ ;)
chipotle has joined #ruby
<gregf_>
er, well s/charliesome/chrislotix/g; :|
rodfersou has quit [Read error: No route to host]
bruno- has quit [Ping timeout: 265 seconds]
nemo__ has quit [Ping timeout: 240 seconds]
tlarevo has quit [Ping timeout: 246 seconds]
rodfersou has joined #ruby
<chrislotix>
gregf_: i figured :) I'm gonna try it now
zenguy_pc has joined #ruby
<gregf_>
chrislotix: that was for you. the filehandle returns a null when it reaches eof. dont you feel thats how it needs to be? you surely dont expect the file to grow magically ;)
mary5030 has joined #ruby
<chrislotix>
I took it from LRTHW, interesting that it doesn't mention that
<gregf_>
chrislotix: just trying to pull yer leg ;)
<apeiros>
chrislotix: me neither. I think gregf_ just misread.
<apeiros>
aha, or that
<apeiros>
gregf_: please don't use "troll" to pull a leg. it's something which can easily get out of hand.
<norc>
So I have a library that interfaces with some really flakey piece of hardware (random timeouts, sometimes commands get mangled up a bit). I managed to catch all the cases and throw an exception in the correct places.
allomov has joined #ruby
nemo_ has quit [Remote host closed the connection]
<gregf_>
apeiros: noted lol
northfurr has joined #ruby
<norc>
So whenever I have my program run with this library, random parts always throw exceptions. Is this a good use case to retry key sending these commands 2-3 times on these expected exceptions?
northfurr has quit [Client Quit]
duckpuppy has quit [Ping timeout: 240 seconds]
Zackio has joined #ruby
<norc>
As in begin; tries ||= 3; rescue FooError; retry unless (tries -= 1).zero?; end
nhhagen has quit [Read error: Connection reset by peer]
nhhagen_ has joined #ruby
<apeiros>
norc: sounds like you don't have much other choice. what you can try is to split up the full task you have to do into as atomic parts as possible. so you have smaller portions of code to retry.
edenc has joined #ruby
mary5030 has quit [Remote host closed the connection]
codecop has joined #ruby
mary5030 has joined #ruby
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
aevitas has quit [Ping timeout: 240 seconds]
nhhagen_ has quit [Remote host closed the connection]
nhhagen has joined #ruby
sdothum has joined #ruby
mary5030 has quit [Ping timeout: 246 seconds]
nhhagen_ has joined #ruby
<norc>
apeiros: I have Connection#execute, which basically takes a command, wraps it inside a protocol and transmits it. So it is a small singular point of entry that I can use here
<i8igmac>
"this Ruby bindings have provided first bridging step towards Ruby GPU computing."
<catphish>
so it comes down to .map{}.join or inject(""){}
arup_r has quit [Read error: Connection reset by peer]
naftilos76 has quit [Ping timeout: 252 seconds]
<canton7>
... or the thing that yorickpeterse just demonstrated
<darix>
i8igmac: what kind of computing you want to do?
northfurr has quit [Quit: northfurr]
f3arl3ss has joined #ruby
<i8igmac>
i guess, generate hash's
<i8igmac>
quicker
<catphish>
canton7: it sure is elegant, but it doesn't deal with the trailing newline properly, specifically an empty array would result in a non-empty string
<canton7>
have you tried simply using a faster language than ruby?
<i8igmac>
that would make sense lol
<canton7>
catphish, right, that's the sort of explanation other people need
northfurr has joined #ruby
<canton7>
catphish, map.join then
tkuchiki has quit [Remote host closed the connection]
<canton7>
i8igmac, you'll likely get a few hundred to a few thousand times speedup by going to something which compiles or jits (from experience with this sort of thing)
<canton7>
i8igmac, or write a ruby extension in C if you need ruby interop still
djbkd has joined #ruby
jessemcgilallen has joined #ruby
djbkd has quit [Remote host closed the connection]
arthurix has quit [Read error: Connection reset by peer]
elusiveother has joined #ruby
arthurix has joined #ruby
djstorm has joined #ruby
<shevy>
I am too sceptical
<shevy>
you are one of the anonymous webchatsters
zeroDivisible has joined #ruby
<norc>
You mean because I only use pastie and not my github gists with a picture and linked instagram with facebook?
devoldmx has quit [Ping timeout: 268 seconds]
yes`r has quit [Ping timeout: 252 seconds]
<shevy>
because you have no face and name :)
tkuchiki has quit [Remote host closed the connection]
<norc>
But I do.
DiCablo has quit [Ping timeout: 268 seconds]
<shevy>
yeah, somewhere outside IRC!
<norc>
shevy: If my face was inside IRC my name would be Skynet. Would you prefer that?
Igorshp has quit [Remote host closed the connection]
<shevy>
oh if it were up to me, I'd revert to good old IRC of the 1990s era
allcentury has quit [Read error: Connection reset by peer]
wprice has joined #ruby
Puck7744 is now known as Puck6633
DiCablo has joined #ruby
tkuchiki has joined #ruby
allcentury has joined #ruby
odigity has quit [Remote host closed the connection]
bruno- has quit [Ping timeout: 250 seconds]
freerobby has joined #ruby
Ox0dea has joined #ruby
diegoaguilar has joined #ruby
dANO- has quit []
jessemcgilallen has quit [Quit: jessemcgilallen]
zenguy_pc has joined #ruby
northfurr has quit [Quit: northfurr]
Motoservo has joined #ruby
inteq has joined #ruby
leat has quit [Remote host closed the connection]
leat1 has joined #ruby
dopamean_ has quit [Ping timeout: 268 seconds]
rbennace_ has joined #ruby
f3arl3ss has quit [Read error: No route to host]
<catphish>
is is possible to make extra initializers in ruby? ie class methods that can create an instance and have access to instance variables?
<Ox0dea>
norc: No difference between C and Assembly, you say?
juanpablo__ has joined #ruby
axl_ has joined #ruby
davedev24 has joined #ruby
<Ox0dea>
catphish: `initialize': already initialized class (TypeError)
gizmore has quit [Ping timeout: 250 seconds]
<Ox0dea>
You won't be able to simply delegate to #initialize, if that's what you hoped to do.
<apeiros>
catphish: the common way is to have a normalized initialize and multiple class methods which normalize input to what initialize expects
tvw has quit [Ping timeout: 256 seconds]
momomomomo has joined #ruby
<catphish>
apeiros: thanks, someone here suggested a normalized initialize that optionally accepts a block and executes it
bruno- has joined #ruby
dionysus69 has joined #ruby
Igorshp has joined #ruby
<norc>
Ox0dea: Well the differences are small at least.
<apeiros>
and no, you can't have multiple initializers. but initialize isn't really anything special. Class#new is essentially `def new(*args, &block); obj = allocate; obj.send(:initialize, *args, &block); obj; end`
<norc>
But that is just a personal opinion, and nothing I want to argue about.
<Ox0dea>
norc: I'm not sure I follow.
nemo_ has joined #ruby
tvw has joined #ruby
davedev2_ has joined #ruby
davedev24 has quit [Read error: Connection reset by peer]
<catphish>
apeiros: that makes a lot of sense, perhaps the alternative is to make pairs of methods, ie a repacement for both new, and initialize together
dionysus69 has quit [Remote host closed the connection]
<apeiros>
catphish: I dislike that option.
<apeiros>
I far prefer normalized initialize.
<catphish>
so a custom "self.new_from_string" which calls #new then
<apeiros>
right
<catphish>
#initialize_from_string
<apeiros>
though I usually omit the "new_" part.
leat1 has quit [Remote host closed the connection]
leat1 has joined #ruby
<apeiros>
def self.from_string(str); …convert str…; new(…); end
dionysus69 has joined #ruby
TvL2386 has quit [Remote host closed the connection]
<catphish>
but you think a unified initialize is neater?
northfurr has joined #ruby
<apeiros>
as said, yes
<Ox0dea>
It's scarcely an opinion.
sankaber has quit [Remote host closed the connection]
mikeharr_ has joined #ruby
<catphish>
you're right, "convert(str)" was the step i was missing, i could make a hash which initialize can then use to populate the object
dorei has joined #ruby
sankaber has joined #ruby
<catphish>
so initialize (and hence new) always accept a hash, which things like from_string can make for it
p0wn3d__ has joined #ruby
<catphish>
thanks for helping me think :)
dmitch has joined #ruby
<shevy>
we train thinking here
zotherstupidguy has quit [Quit: WeeChat 1.3]
<apeiros>
Ox0dea: what's it if not an opinion? :)
<Ox0dea>
apeiros: Objectively sane.
bruno- has quit [Ping timeout: 260 seconds]
mikeharris22 has quit [Ping timeout: 240 seconds]
nertzy has quit [Quit: This computer has gone to sleep]
akem has joined #ruby
arup_r has quit [Ping timeout: 255 seconds]
howdoi has quit [Quit: Connection closed for inactivity]
jas02_ has joined #ruby
<shevy>
that's just your opinion!!!
zotherstupidguy has joined #ruby
<shevy>
Object.sane
gregf_ has quit [Read error: No route to host]
<norc>
Ox0dea: Large parts of C can be mapped into machine code directly (OTCC demonstrates this, albeit with only a limited subset of C)
jas02 has quit [Ping timeout: 256 seconds]
jas02_ is now known as jas02
davedev24 has joined #ruby
<ddv>
opinions are like....
gizmore has joined #ruby
hiyosi has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Motoservo has quit [Quit: Shhh. I'm trying to get some sleep here.]
haxrbyte_ has joined #ruby
<Ox0dea>
norc: mov is Turing-complete; what's your point?
kp666 has quit [Quit: Leaving]
<norc>
As I said, I didn't want to argue.
everbot has quit [Ping timeout: 240 seconds]
<Ox0dea>
We'll still be friends when the dust settles.
davedev2_ has quit [Ping timeout: 246 seconds]
beast has quit [Quit: Leaving]
<pipework>
Ox0dea: Hey, what was that neat thing that was like &proc?
<Ox0dea>
norc: Explicitly manipulating a stack with `goto` really is an entirely different experience to having your locals appear on the stack as you enter and leave functions.
dopamean_ has joined #ruby
stevednd has quit [Remote host closed the connection]
newdan has joined #ruby
<Ox0dea>
pipework: Hm? `&proc` is already a thing, but I don't know that it has any kin.
<pipework>
Ox0dea: I must be doing something unexpected.
<pipework>
I guess calling &proc twice in a method body doesn't do what I expect.
<yorickpeterse>
Any OS X users here? If so, does the following spit out your user/group IDs?: socket = UNIXServer.new('/tmp/test.sock'); socket.getsockopt(Socket::SOL_SOCKET, Socket::SO_PEERCRED).unpack('iii')[1..-1]
elusiveother has quit [Quit: Leaving]
trautwein has joined #ruby
bMalum_ has joined #ruby
<gizmore>
get 'foo' => "bar" # what is this? a lambda?
<hxegon>
I seriously don't understand how people live without blocks. Is this a phase?
mjuszczak has quit []
<Ox0dea>
hxegon: Welcome to the end of your search for your favorite language.
<pipework>
I don't always use blocks in my interfaces because it's sometimes hard for other people to get what's going on.
<pipework>
casuals. meh
Guest53 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tkuchiki has quit [Remote host closed the connection]
tw1sted has quit [Remote host closed the connection]
cwong_on_irc has joined #ruby
dellavg_ has joined #ruby
Gi0 has joined #ruby
codecop has quit [Remote host closed the connection]
norc has quit [Ping timeout: 246 seconds]
kohgpat has joined #ruby
Guest53 has joined #ruby
stamina has joined #ruby
weihan has quit [Ping timeout: 244 seconds]
tulak has quit [Remote host closed the connection]
tw1sted has joined #ruby
hxegon_ has joined #ruby
terminalrecluse has joined #ruby
<capin>
catphish: see my earlier post ;) it allows hypervisor access to the kernel so a VM runs at near native speed :D
rikkipitt has joined #ruby
tk__ has quit [Quit: ばいばい]
northfurr has quit [Quit: northfurr]
<Erik_Underline>
What's the most awesome thing you've ever done in Ruby?
colegatron has joined #ruby
Igorshp has joined #ruby
<colegatron>
hello, a newbie question; in the sentence "config.vm.define :whatever do |server|" what is :whatever? a method? a function?
hxegon has quit [Ping timeout: 255 seconds]
<Erik_Underline>
:whatever is a symbol
<capin>
what he said ^
terminalrecluse has quit [Client Quit]
<Erik_Underline>
Everything after : is a "symbol" in ruby
<colegatron>
aha
<capin>
Erik_Underline: is it fair to say a "symbol is a data structure?
<catphish>
capin: it's not really clear to me what it actually does though, seems to provide access to certain memory locations, and presumably also a way to access calls to change ring
arup_r has joined #ruby
<catphish>
just realised this is #ruby :) im a little offtopic :)
valkyrka has joined #ruby
<Erik_Underline>
capin: I don't really know what that would imply
mary5030 has quit [Ping timeout: 250 seconds]
<colegatron>
but I understand ":whatever" is an object as well, isn't?
krz has quit [Quit: WeeChat 1.2]
eminencehc has quit [Remote host closed the connection]
<hxegon_>
colegatron: in that case I think its used like an option to config.vm.define
<hxegon_>
colegatron: but yes, a symbol is an object
<Erik_Underline>
capin: data structures are hashes and arrays, so no, it wouldn't be.
<colegatron>
hxegon_, oh. it makes sense
<colegatron>
hxegon_, I need, inside the 'define' block, to get in a variable, the string representation of the "whatever" option/symbol
mjuszczak has joined #ruby
mjuszczak has quit [Max SendQ exceeded]
<slash_nick>
DeBot: g
eminencehc has joined #ruby
<hxegon_>
colegatron: you will also see these used as hash keys because they are more memory efficient to use than strings, + other reasons someone should enumerate
<capin>
catphish: i think the take away is you can't use KVM in OS X (which really hurts the speed of the VM) almost to the point that it's not worth using
mjuszczak has joined #ruby
urbanmonk has quit [Quit: urbanmonk]
<hxegon_>
capin: are you trying to use vagrant?
<colegatron>
hxegon_, in this particular case is the name of the vagrant vm, but I need that name "whatever" into a variable
<Ox0dea>
slash_nick: Well done.
<hxegon_>
capin: got confused sorry
<catphish>
capin: doesn't OS X have its own virtualization API? virtualbox support os x afaik, i assume it doesn't rely on soft emulation
<hxegon_>
colegatron: whats the :whatever in this case? have a bit of experience with vagrant
sgambino has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<catphish>
not being able to use qemu could be annoying though
<colegatron>
whatever is the name of the vm you are defining in the config.vm.define block.
lavros has quit [Quit: leaving]
Motoservo has joined #ruby
<colegatron>
I need to take the name (whatever) to avoid repeat the text "whatever" all over the place inside the definition.
<catphish>
i'll have to write my own hypervisor one day :)
<colegatron>
I mean : tmpName = letSayGetOption(0).from.define
Lucky__ has joined #ruby
<capin>
catphish: apple said they were going to expose the hypervisor in a recent version of OS X (don't remember off the top of my head) but i think the qemu devs still haven't written in support for KVM yet, and I'm not a fan of using vbox FWIW
<hxegon_>
colegatron: you could define the name outside the scope of the block and use it that way, but there is probably a better solution
<catphish>
capin: it won't be kvm, since kvm is specifically a linux module
<hxegon_>
capin: why not, out of curiosity? (I use vbox w/ vagrant on OS X)
<catphish>
capin: but i'd hope qemu would support apple's API at some point
<colegatron>
hxegon_, I define lots of VM's in the same vagrantfile. and I do not want to work out of the scope if it is possible
<capin>
catphish: ME TOO!
<catphish>
i use vbox for desktop VMs, always seems convenient
<hxegon_>
colegatron: ahh, I see. I only use one at a time.
<catphish>
i use kvm/qemu on the server side
<Ox0dea>
colegatron: You want access to :whatever from within the #define block?
<colegatron>
to the _string_representation_ not the object
<colegatron>
I need it to use in the scripts I use for provisioning and other deploys that are fired once the vm is up
<Ox0dea>
colegatron: Are you not creating these VMs dynamically in some sort of loop?
stamina has quit [Ping timeout: 268 seconds]
<colegatron>
Ox0dea, not at this moment, so no.
eminencehc has quit [Remote host closed the connection]
<colegatron>
Ox0dea, next iteration/feature will be inside a loop
<Ox0dea>
colegatron: Then something like `config.vm.define(foo = :whatever) { ... }` will suffice.
<Ox0dea>
You'll have access to `foo` within the block.
<capin>
catphish: maybe we should go bug the qemu devs over at their irc server :P ..."hey man when yall going to get hypervisor support for OSX" :P
<colegatron>
Ox0dea, OOOhhh nice
<colegatron>
I'm going to play
<Ox0dea>
Yay! <3
eminencehc has joined #ruby
_blizzy_ has quit [Quit: Leaving]
f3arl3ss has joined #ruby
f3arl3ss has quit [Read error: Connection reset by peer]
<colegatron>
Ox0dea, Aside the global variable this construction is correct, right? config.vm.define( $cI = :worker_swfdev, autostart: false ) do |server|
<Ox0dea>
colegatron: It is.
mikeharris22 has quit [Remote host closed the connection]
eminencehc has quit [Remote host closed the connection]
devoldmx has joined #ruby
marr has quit [Ping timeout: 240 seconds]
Motoservo has quit [Read error: Connection reset by peer]
towski_ has joined #ruby
bb010g has quit [Quit: Connection closed for inactivity]
mikeharris22 has joined #ruby
cirenyc has joined #ruby
purplexed- has joined #ruby
purplexed- has joined #ruby
hmsimha_ has joined #ruby
Motoservo has joined #ruby
<colegatron>
Ox0dea, great, it works. I've replaced the global var for a local one and it's almost ready to be converted in a loop to deploy servers :)
devoldmx has quit [Ping timeout: 244 seconds]
<Ox0dea>
colegatron: Huzzah!
umgrosscol has quit [Remote host closed the connection]
ruurd has quit [Quit: ZZZzzz…]
zenguy_pc has quit [Ping timeout: 268 seconds]
amclain has joined #ruby
freerobby has quit [Quit: Leaving.]
mrtomme has quit [Ping timeout: 260 seconds]
mikeharris22 has quit [Ping timeout: 246 seconds]
startupality has joined #ruby
ruurd has joined #ruby
SCHAAP137 has quit [Remote host closed the connection]
senayar has quit []
mrtomme has joined #ruby
TomyWork has quit [Ping timeout: 260 seconds]
catphish has left #ruby ["Leaving"]
mary5030 has joined #ruby
lsmola has quit [Ping timeout: 244 seconds]
mjuszczak has quit []
roxtrongo has quit [Remote host closed the connection]
<colegatron>
Ox0dea, as far as I understand the vm.server block on the following code (https://paste.debian.net/318887) should work even if for each vm I defined in the vagrant file
RegulationD has quit [Remote host closed the connection]
<colegatron>
I mean if I change what the vm.server block does for each vm
Motoservo has quit [Read error: Connection reset by peer]
<Ox0dea>
hxegon: It's going to be a shitstorm until everybody goes to bed, and it'll be done five minutes later.
<colegatron>
Ox0dea, yes, and if finally I put all inside a loop, the server.vm.provision would change aswell doing different things depending on a cI attribute
<Ox0dea>
As an aside, I had "hxegon_" in my message line and it lost its highlighting when you changed nicks; I didn't know that would happen.
dfockler has joined #ruby
startupality has joined #ruby
htmldrum has quit [Ping timeout: 244 seconds]
devoldmx has joined #ruby
dopamean_ has quit [Ping timeout: 256 seconds]
<colegatron>
but I understand, being the server.vm.provision inside the same .define block, will not have side effect or strange behaviors because ruby
<Ox0dea>
Probably don't actually use that, though.
pwnd_nsfw has quit [Ping timeout: 240 seconds]
<hxegon>
Ox0dea: yeah, thats..... hmm
<Ox0dea>
It's neat, but best to leave it at that.
<Erik_Underline>
In a method for JS(function is the proper term), Python etc, if you don't specify what to return, it'll return undefined etc but Ruby methods will return the result of the last evaluated expression, why is that?
trautwein has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sandals has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Erik_Underline>
I get why ruby does it, but why not the other languages?
<Ox0dea>
Erik_Underline: It's just another way in which they're inferior.
<Ox0dea>
Even LOLCODE returns the last evaluated expression.
mh_laakso has joined #ruby
roxtrongo has quit [Remote host closed the connection]
<Ox0dea>
Erik_Underline: In all seriousness, it's because Ruby was designed for programmer happiness; precious few other languages bother to take that into account.
gizmore has quit [Read error: Connection reset by peer]
nemo__ has quit [Ping timeout: 252 seconds]
<hxegon>
Erik_Underline: having to put in return statements everywhere is a given in any non-imperitave program
<Erik_Underline>
Is there any advantage to it?
shinnya has joined #ruby
<Ox0dea>
hxegon: Huh? All of the languages recently mentioned are imperative.
nemo_ has joined #ruby
nemo_ has quit [Read error: Connection reset by peer]
baroquebobcat has joined #ruby
nemo_ has joined #ruby
<hxegon>
Ox0dea: sorry, trying to express a not completely formed idea, give me a minute. Erik_Underline disregard what I just said
<Ox0dea>
Erik_Underline: You have to use an explicit `return` if you want to return early (before the end of the method), and some argue that consistency must always be striven for.
Motoservo has quit [Read error: Connection reset by peer]
<Ox0dea>
But Ruby methods are often "properties", and `return` looks awkward in that context.
mallu has joined #ruby
gizmore has joined #ruby
<Erik_Underline>
What do you mean with that ruby methods are 'properties'?
bMalum has quit [Quit: bMalum]
mjuszczak has joined #ruby
leafybas_ has joined #ruby
snockerton has joined #ruby
<slash_nick>
Erik_Underline: class Sloth; def herbivore; return true; end; end
<mallu>
I see mthod 'grep'. Is there anything similar to "grep -v". Ie; exclude the pattern?
jpfuentes2 has joined #ruby
<Erik_Underline>
Btw, what if there's no return written in a method, but you don't want the value of the last evaluated expression anyhow, what do you do then?
<Ox0dea>
Erik_Underline: You make `nil` the last evaluated expression.
<newdan>
Erik_Underline: explicit returns have advantages, namely that you can never 'accidentally' return something from a function that you didn't intend to. In Ruby you can write a method that's meant for side effects but that accidentally returns something and if the stars align someone else in your org will start relying on it and that will be awkward and bad. But in general I like implicit returns
shinobi_ has joined #ruby
SylarRuby has quit [Remote host closed the connection]
hmsimha_ has quit [Ping timeout: 265 seconds]
unreal has joined #ruby
fibbel has joined #ruby
synthroid has quit [Remote host closed the connection]
tulak has joined #ruby
<mallu>
Ox0dea: how do you do multiple pattern?
<Ox0dea>
mallu: Regexp.union should suffice.
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
<Ox0dea>
Or just chain your invocations of #!~ with ||.
<mallu>
ok
rbennacer has joined #ruby
pocketprotector- has joined #ruby
Lingo_ has joined #ruby
Lingo_ has quit [Remote host closed the connection]
Lingo_ has joined #ruby
FernandoBasso has joined #ruby
Lingo_ has quit [Remote host closed the connection]
<ruboto>
gregf_ # => wrong number of arguments (0 for 2) (ArgumentError) ...check link for more (https://eval.in/460307)
<hxegon>
Ox0dea: ahh, whereas a lamda will give you an argument error when appropriate right?
<gregf_>
hxegon: ^^
<gregf_>
>> proc { |a,b| puts a + b }.call()
<ruboto>
gregf_ # => undefined method `+' for nil:NilClass (NoMethodError) ...check link for more (https://eval.in/460308)
<Ox0dea>
gregf_: You're being noisy. :<
arthurix has quit [Ping timeout: 260 seconds]
<hxegon>
what is this -> BS
<Ox0dea>
hxegon: -> is another way to create a lambda.
<Ox0dea>
-> x, y {} == lambda { |x, y| }
armyriad has quit [Ping timeout: 265 seconds]
agit0 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<hxegon>
oh yeah! the other way is kind of cumbersome
<Ox0dea>
I agree.
mistermocha has quit [Ping timeout: 240 seconds]
<Ox0dea>
Lambdae are better than Procs, and we get a sexy syntax for them to boot.
<mallu>
how do you sort this json file? ["a", "c", "f", "b", "d"]
aevitas has joined #ruby
<gregf_>
hxegon: its what Ox0dea said. lambda need the args, in a proc they aren;t mandatory. sorry about that Ox0dea . i know interrupting is annoying :|
Igorshp has quit [Remote host closed the connection]
<Ox0dea>
gregf_: No, you weren't interrupting; you were just making ruboto spew.
armyriad has joined #ruby
<gregf_>
sorry ruboto ;)
snockerton has joined #ruby
<hxegon>
are lambdas and procs interchangable with procs? can I just start spamming lambdas everywhere?
<Ox0dea>
mallu: That's an Array.
Alayde has joined #ruby
Motoservo has quit [Read error: Connection reset by peer]
<hxegon>
that first sentance lol
<Ox0dea>
hxegon: ...
Alayde has left #ruby [#ruby]
umgrosscol has joined #ruby
<hxegon>
Ox0dea: at least I'm honest
<Ox0dea>
We've just discussed the primary difference.
mikecmpbll has quit [Ping timeout: 260 seconds]
<hxegon>
Ox0dea: alright alright, I'll stop with the stupid questions :P
timonv has quit [Ping timeout: 264 seconds]
mois3x has joined #ruby
<gregf_>
mallu: require "json"; p JSON.parse(%{["a", "c", "f", "b", "d"]}) <== like that?
<gregf_>
hxegon: you need to be careful with Ox0dea. you could get lost ;)
nertzy has quit [Quit: This computer has gone to sleep]
nemo_ has quit [Remote host closed the connection]
The_Phoenix has joined #ruby
jackjackdripper has joined #ruby
sudiptamondal has joined #ruby
sudiptamondal has quit [Max SendQ exceeded]
<Ox0dea>
hxegon: #map expects a block and you gave it one.
<hxegon>
Ox0dea: so did you but it returned a single value, is that because it's inside a function?
<hxegon>
Ox0dea: or is it not a block in that case?
GORDON6 has joined #ruby
<GORDON6>
is this rub & rails ?
<GORDON6>
ruby & rails
<Ox0dea>
?rails GORDON6
<ruboto>
GORDON6, Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
bMalum has quit [Quit: bMalum]
<Ox0dea>
hxegon: I'm not sure I understand the question.
<Ox0dea>
Your example demonstrates that `&` can be used to treat a Proc like a block, not the difference in return semantics between Procs and lambdae.
<GORDON6>
so Ruby is different than RubyOnRails
<GORDON6>
guys i m old school i just installed mirc
willardg has joined #ruby
<GORDON6>
i am amazed to see people are studying in here
Motoservo has joined #ruby
<hxegon>
GORDON6: rails is a framework for ruby
tigarcia has quit [Remote host closed the connection]
<eam>
wow, I didn't realize return doesn't return from a proc. I suppose that's to allow stuff like
<hxegon>
Ox0dea: I'm going to do some research on this and get back to you
<Ox0dea>
hxegon: Sounds good.
hightower2 has joined #ruby
bMalum has joined #ruby
joonty has quit [Quit: joonty]
sandals has joined #ruby
naftilos76 has quit [Ping timeout: 250 seconds]
ghoti has joined #ruby
BSaboia has joined #ruby
tigarcia has joined #ruby
willardg has quit [Client Quit]
dellavg_ has quit [Ping timeout: 260 seconds]
rakm has joined #ruby
zotherstupidguy has joined #ruby
barhum2013 has quit [Quit: barhum2013]
shredding has quit [Ping timeout: 246 seconds]
barhum2013 has joined #ruby
<hxegon>
Ox0dea: ahh, the implicit return in the proc confused me. I get it now. I was didn't think there would be a difference between proc { |i| return i+1} and proc { |i| i+1 }
Motoservo has quit [Ping timeout: 250 seconds]
ghoti has quit [Ping timeout: 272 seconds]
tw1sted has quit [Changing host]
tw1sted has joined #ruby
Musashi007 has joined #ruby
umgrosscol has quit [Remote host closed the connection]
<hxegon>
Ox0dea: I now realize that is exactly what you were saying... I'll go in the corner now
<Ox0dea>
hxegon: Be never ashamed of your own edification.
stan has quit [Ping timeout: 260 seconds]
Motoservo has joined #ruby
<dorei>
how can i remove these silly "\xC2", "\xA0" from a string?
<Ox0dea>
dorei: How'd they get there?
<dorei>
nbsp :p
<dorei>
i remembered
wldcordeiro has quit [Ping timeout: 268 seconds]
<dorei>
[[:space:]]
k3asd` has quit [Ping timeout: 272 seconds]
<hxegon>
lol: "I was didn't think there would be..." - hxegon 2015
skweek has joined #ruby
<Ox0dea>
> Has anyone ever been far as decided even go want to do look more like?
<eam>
string.bytes.select {|c| c < 0x80}.map(&:chr).join
akem has quit [Ping timeout: 252 seconds]
<hxegon>
Sometimes I can't belive english is my first lang >.<
Motoservo has quit [Read error: Connection reset by peer]
mikeharris22 has joined #ruby
<TheNet>
with the second line you avoid creating the string if it's not going to be used, but then you have to write 'if DEBUG' after every debug message, which isn't very DRY
<Ox0dea>
TheNet: Seems you know all you need to make the right decision.
<eam>
use a gettext module for i18n and then the former isn't any more expensive :)
ibouvousaime has quit [Ping timeout: 240 seconds]
Musashi007 has quit [Quit: Musashi007]
Motoservo has joined #ruby
<Ox0dea>
Or just freeze it. :P
ibouvousaime has joined #ruby
EmeraldExplorer has joined #ruby
Erik_Underline has quit [Ping timeout: 246 seconds]
<Ox0dea>
fschuindt: Ah, well, you'll want to say `people.insert(2, *new_people)`.
synthroid has joined #ruby
<fschuindt>
yes
<Ox0dea>
Without the * to "spread" the array into separate arguments, you'd insert an Array instead of its components.
arup_r has joined #ruby
<al2o3-cr>
too slow :(
roxtrongo has joined #ruby
_blizzy_ has joined #ruby
Icey has quit [Remote host closed the connection]
nemo_ has quit [Ping timeout: 265 seconds]
<TheNet>
Ox0dea: not quite sure what that's telling me
<Ox0dea>
TheNet: It's telling you how many occurrences of that one String are alive in the system.
Motoservo_ has joined #ruby
Motoservo has quit [Read error: Connection reset by peer]
Motoservo_ is now known as Motoservo
<mh_laakso>
Does anyone have an opinion on Ruby in Canada re: jobs?
<mh_laakso>
I know Shopify uses it for their code base
<fschuindt>
Ox0dea: thank you again man, It workend :)
<fschuindt>
worked*
<Ox0dea>
fschuindt: Happy to help.
DEA7TH has joined #ruby
<Ox0dea>
TheNet: I realize you probably can't freeze your debug strings by dint of their being dynamic, but look what happens if you can: https://eval.in/460347
TheNet has quit [Read error: Connection reset by peer]
<Ox0dea>
Fine.
<diegoviola>
I refuse to join #rubyonrails, the last time I been there they asked me to STFU
cdg has quit [Remote host closed the connection]
<diegoviola>
I won't join there ever again
<Ox0dea>
diegoviola: Are you going to refuse to join #ruby if somebody here advises you similarly?
TheNet has joined #ruby
<diegoviola>
Ox0dea: yes, I don't want to be in a toxic community
<eam>
just allow Log.debug to take a symbol
Motoservo has quit [Read error: Connection reset by peer]
<eam>
Log.debug :"my error message here"
<Ox0dea>
TheNet is worried about an object being created at all.
<TheNet>
^
<shevy>
objectitis - fear of objects
<Ox0dea>
TheNet: And that's laudable, but having to tack `if DEBUG` on the end is largely just noise.
<eam>
well it won't be created per call, right?
<eam>
that's kinda the point of a symbol
roxtrongo has quit []
<shevy>
diegoviola good that the communities are different!
<TheNet>
eam it's a log message so it'll probably be different each time
DEA7TH has quit [Quit: DEA7TH]
<eam>
ah. Make your logger method take sprintf style args?
<eam>
have *it* do the dynamic bits
<Ox0dea>
Yep, that'd be the best approach.
arup_ has joined #ruby
<Ox0dea>
Freeze the format strings, of course.
<TheNet>
could I use a block?
riceandbeans has joined #ruby
<eam>
Ox0dea: btw, I bet ObjectSpace lies about how many actual copies of the strings it makes
andikr has quit [Remote host closed the connection]
<TheNet>
Log.debug { "this #{var} string" }
arup_ has quit [Read error: Connection reset by peer]
<Ox0dea>
eam: What makes you say so?
<Ox0dea>
TheNet: You could, but why?
<riceandbeans>
anyone know of if there's a better looking major mode in emacs for ruby than the stock one?
<riceandbeans>
I mean, it works fine, I was just hoping for a LITLE more color
<TheNet>
Ox0dea: it seems pretty simple, just curly braces instead of parenthesis
dikaio has joined #ruby
arup_r has quit [Ping timeout: 255 seconds]
<Ox0dea>
Are you trolling...?
<Ox0dea>
>> ObjectSpace.each_object(String).select { |s| s == 'foo' }.map(&:object_id).uniq.size # eam
<eam>
Ox0dea: you'd have to inspect from outside ruby
Motoservo has joined #ruby
<danneu>
the more i watch these ad-hoc filter/select/map examples
<riceandbeans>
havenwood: Control+x then Control+C
<riceandbeans>
err, c
<TheNet>
Yeah I think passing a block into Log.debug is the best choice for me
<eam>
Ox0dea: actually I only see 3 copies, so hey
<eam>
close
<diegoviola>
shevy: I don't care about these languages
<havenwood>
riceandbeans: -UUU:----F1 *scratch*
<havenwood>
riceandbeans: The plot thickens...
chipotle has quit [Quit: cheerio]
<TheNet>
then in Log.debug I can do something like "message = yield if DEBUG"
<eam>
TheNet: def debugf(fmt, *args); sprintf fmt, *args; end; Log.debugf "my %s is %s!", "whale", "purple"
<riceandbeans>
havenwood: in emacs, unlike where vi(m) with everything being relation to ed and piped through ed, most all commands are based off the alt, shift, and control keys
<riceandbeans>
ed commands and essentially piped through ed
syath has quit [Quit: WeeChat 1.2]
asianMike has quit [Remote host closed the connection]
finisherr has joined #ruby
<riceandbeans>
havenwood: so there's notations like C-a or M-x (M is Meta which is alt), or S-whatever, in reference to key combos
<shevy>
diegoviola haha yeah me neither
pandaant has quit [Remote host closed the connection]
<havenwood>
riceandbeans: I'm *mostly* just kidding (I sometimes get stuck in emacs).
__chris has quit [Ping timeout: 244 seconds]
<TheNet>
eam: isn't a block better
Motoservo has quit [Read error: Connection reset by peer]
<riceandbeans>
oh
<eam>
is it Ok to create a new Proc?
<riceandbeans>
sorry
<Ox0dea>
TheNet: Aye, you were worried about object allocation, no?
<eam>
if you're worried about creating strings, I imagine you're also worried about creating blocks
umgrosscol has joined #ruby
Motoservo has joined #ruby
Guest53 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<riceandbeans>
havenwood: I'm not hating on vim, I just ended up trying out emacs a couple years back and growing to like it better than vim, they're both fine by me but I'm more fluent in emacs and I feel more comfortable in it
<riceandbeans>
:P use what you like best and makes you happy
beauby has joined #ruby
<eam>
and by the way, we're quickly approaching the "perhaps ruby isn't the right language for this kind of optimization" :)
<TheNet>
eam: I'm more worried about string interpolation
<eam>
TheNet: I recommend benchmarking the various options, given the particulars of your use case (which we really don't know0
bjhaid has joined #ruby
<bjhaid>
hi
<eam>
make sure your assumptions about cost are correct
tjohnson has joined #ruby
<TheNet>
alright, thanks
TheNet has quit [Remote host closed the connection]
Guest53 has joined #ruby
<bjhaid>
how does one create a gemspec.rz file, more importantly whats the easiest way to read the gemspec file
fantazo has quit [Ping timeout: 265 seconds]
TheNet has joined #ruby
<eam>
from a discussion about why Array#[] can't necessarily give parse-time errors about x["oops"]: ObjectSpace.each_object(Array).to_a.sample.instance_eval { def [](*x); "loooooool what is going on"; end }
momomomomo has joined #ruby
dopamean_ has joined #ruby
<havenwood>
riceandbeans: I usually vim and only dabble in emacs from time to time playing with Xiki. I've recently got re-interested after looking at the alchemist package for elixir but haven't had time to explore!
Motoservo has quit [Read error: Connection reset by peer]
DoubleMalt has quit [Remote host closed the connection]
agit0 has joined #ruby
linocisco has joined #ruby
<riceandbeans>
elixir? you do erlang?
Motoservo has joined #ruby
dasher00 has quit [Remote host closed the connection]
Motoservo has quit [Client Quit]
beauby has quit [Ping timeout: 264 seconds]
<Ox0dea>
bjhaid: A gemspec.rz file is Zlib.deflate(Marshal.dump(foo)), where foo is an instance of Gem::Specification.
platzhirsch has left #ruby [#ruby]
<bjhaid>
Ox0dea: I know
<bjhaid>
I was asking how to create it
<bjhaid>
but I think I have found my answer
<Ox0dea>
bjhaid: The process is invertible.
agit0 has quit [Ping timeout: 260 seconds]
<bjhaid>
Ox0dea: the process is invertible but getting the specification from the gemspec is where I have been stucked
<bjhaid>
I would go with `gem specification some_gem.gem` for now
_djbkd has quit [Remote host closed the connection]
<Ox0dea>
bjhaid: Gem.latest_spec_for(foo)
maletor has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<bjhaid>
Ox0dea: can foo be a raw gem? like file on disk
linocisco has quit [Ping timeout: 256 seconds]
<Ox0dea>
bjhaid: No.
<bjhaid>
so what I want is for a file on disk
tref has joined #ruby
bMalum has joined #ruby
purplexed- has joined #ruby
<tref>
Hey guys, I’ve got an interesting question and altough this pertains to ruby with a persistence layer I think this is the best place to ask.
<Ox0dea>
bjhaid: Are you sure this is what you need to do?
aevitas has joined #ruby
diego3 has joined #ruby
<tref>
Im creating a url shortening service and trying to generate the shortest possible url safe url
<bjhaid>
yes, so I have a rubygems mirror and I want to create spec files for local gems
diego3 has quit [Changing host]
diego3 has joined #ruby
diegoviola is now known as Guest9660
diego3 is now known as diegoviola
<Ox0dea>
bjhaid: .gemspecs, or .gemspec.rzs?
<tref>
Im planning to use SecureRandom.urlsafe_base64 but I need to ensure that each ‘shortened’ url is unique
<bjhaid>
.gemspec.rz
<eam>
tref: why not just have an incrementing serial walking through whatever encoding you're using?
<bjhaid>
to use in generating the specs file for the rubygems mirror
baroquebobcat has quit [Quit: baroquebobcat]
<tref>
I was thinking of doing it serially
bb010g has joined #ruby
<tref>
I guess there’s no reason that I cant
<Ox0dea>
bjhaid: But these local gems do have gemspecs, yes?
dmitch has joined #ruby
<bjhaid>
yes
<bjhaid>
they have gemspecs
<eam>
if you need parallelism, just apportion out regions of the serialized space to each parallel entity
<eam>
aka thread 1 gets to generate odd and thread 2 gets to generate even
<tref>
eam: what im a little unsure of is how I would go about finding out what the ‘next’ entry would be serially
<eam>
(use any modulous for any level of parallelism)
Guest9660 has quit [Ping timeout: 265 seconds]
<eam>
lous? what's wrong with me
EllisTAA has quit [Quit: EllisTAA]
<tubbo>
no-time toulouse
<eam>
tref: well, you have a set of valid characters, right? for simplicity's sake let's say that's "a".."z"
dfockler has quit [Ping timeout: 250 seconds]
<bjhaid>
Ox0dea: I don't know how to create the Gem::Specification from the gemspec, that was my initial question
<tref>
yeah it would be A-Z, a-z, 0-9, “-” and “_”
<tref>
sem: A-Z, a-z, 0-9, “-” and “_” (sorry forgot the name)
aevitas has quit [Ping timeout: 252 seconds]
<eam>
so you need f(x) where x is your integer sequence and f(x) is the position encoded in your sequence
<eam>
"a".."z" is base 26
<djellemah>
bjhaid: Have you seen gem help generate_index ?
<eam>
so it's pretty easy to write f
The_Phoenix has quit [Read error: Connection reset by peer]
bryanray has joined #ruby
<bjhaid>
nope
Musashi007 has joined #ruby
<eam>
A-Za-Z0-9-_ is just a larger base
<bjhaid>
would have a peek
EvilCorp_IT_Tech has quit [Ping timeout: 260 seconds]
jackjackdripper has quit [Quit: Leaving.]
<eam>
f(1) -> "a"
jackjackdripper has joined #ruby
<eam>
f(26) -> z, f(27) -> "aa
<eam>
or w/e
bryanray has quit [Read error: Connection reset by peer]
TheNet has quit [Remote host closed the connection]
akem has joined #ruby
TheNet has joined #ruby
<Ox0dea>
>> 'z'.next
<bjhaid>
Ox0dea: thanks, that's what I have been thinking of how to implement
<eam>
tref: well, do you know how to convert number bases?
<atmosx>
by default Pony.mail uses sendmail?
<tref>
eam: I dont
sdothum has joined #ruby
pullphinger has joined #ruby
<finisherr>
Is there simple way of passing in some sort of hash path to a method so the hash inside the method can use it to access the value at that path?
beauby has joined #ruby
rikkipitt has joined #ruby
FernandoBasso has quit [Quit: Leaving]
TheNet has joined #ruby
jonee has quit [Read error: Connection reset by peer]
<eam>
tref: if you look up how, and apply those principals to convert to base 55 you'll have what you need (I'm happy to help but, not sure I want to write the thing for you)
devbug has joined #ruby
<eam>
is it base55? no, it'd be base64, right?
<eam>
I think you can do base65 without padding
<eam>
anyway, it doesn't really matter what characters you decide to map your sequence onto
<havenwood>
jxl180: See #map: @server.datacenter_options.map do |dc|; [dc[:name], dc[:longName]]; end
karapetyan has quit [Remote host closed the connection]
<tref>
eam: I had something like that [*'0'..'9', *'a'..'z', *'A'..'Z', "_", "."].sort! {|a,b| a <=> b}
diegoviola has quit [Ping timeout: 255 seconds]
_djbkd has joined #ruby
<jxl180>
Ox0dea: Thanks!
<eam>
tref: ok, so f(0) == "." right?
<tref>
yeah
<eam>
this is easy up to f(64), then at f(65) you need "0."
<tref>
eam: yes
<eam>
you can figure out the value in each place with div / mod 65
<eam>
or powers of 65
jxl180 has quit [Quit: ChatZilla 0.9.92 [Firefox 41.0.2/20151015125802]]
dellavg_ has quit [Ping timeout: 260 seconds]
<eam>
and the integer you have for each place (like [1, 0] in the above example for f(65)) you'd find with [*'0'..'9', *'a'..'z', *'A'..'Z', "_", "."].sort! {|a,b| a <=> b}[x]
helpa has quit [Remote host closed the connection]
<eam>
[*'0'..'9', *'a'..'z', *'A'..'Z', "_", "."].sort! {|a,b| a <=> b}[1] == "0" and [0] == "."
<eam>
right?
helpa has joined #ruby
freerobby has joined #ruby
<tref>
yes
snow2222 has joined #ruby
<tref>
eam: with your example it would be 64 I believe
<snow2222>
hey, I'm trying to use mechanize to log into a microsoft (NTLM) authentication pop-up that goes through the browser (i.e "Authentication Required" popup) and I can't seem to get it right
<snow2222>
I've tried things I found from stackoverflow
nertzy has joined #ruby
<snow2222>
I've even tried curl and postman, nothing seems to help
<shevy>
what did you try, can you link
TheNet has quit [Remote host closed the connection]
<snow2222>
tried this, got the same error in the comment
<snow2222>
when I try and find the authentication pop -up, i cant even find it on the DOM
<tref>
eam: so in order to get the next value of say a http://short.url/A9 I could pop the last value (which is 9) and find its index in the charset ([*'0'..'9', *'a'..'z', *'A'..'Z', "_", "."]) and increment it
<eam>
is there a nice syntax to swap two methods without three alias_method invocations?
stamina has joined #ruby
TheNet has quit [Remote host closed the connection]
<eam>
tref: yes. more generally you probably just want to write an integer to base65, and base65 to integer method
momomomomo has quit [Ping timeout: 250 seconds]
jamesaxl|2 has joined #ruby
x-light has joined #ruby
<tref>
eam: hmm ok what might that look like and I’ll stop bothering you and take a swing at it :) You’ve been extremely helpful
<eam>
tref: so, say I have f(12345)
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<tref>
eam: where would the value 1234 come from?
<eam>
I'm just making it up
momomomomo has joined #ruby
<eam>
it's an integer that I want to convert to this base65 sequence
<tref>
eam: ok
<eam>
>> 12345.to_s(65)
Channel6 has joined #ruby
<ruboto>
eam # => invalid radix 65 (ArgumentError) ...check link for more (https://eval.in/460363)
BTRE has quit [Ping timeout: 252 seconds]
<eam>
so unfortunately, ruby doesn't define large bases (because there's no agreemnt on what symbols to use, I presume)
<eam>
but we've defined it, via that big [] above
<tref>
hmm
<eam>
so I need to know the 0..64 value of each digit, right?
FungalRaincloud has joined #ruby
bruno- has quit [Ping timeout: 256 seconds]
<tref>
eam: yes
<eam>
12345 / 65**3 is zero, so I have no digit in the 3rd place
TheNet has joined #ruby
<eam>
12345 / 65**2 is 2, so I have that_mapping_above[2] in the 2nd place, right?
beauby has joined #ruby
synthroid has quit [Remote host closed the connection]
<eam>
and then 12345 % 65**2 is 3895, which is what I have left over for the 1 and 0th place, right?
<eam>
(sorry I'm being terrible with my off by one)
<eam>
so 3895 / 65**1 = 59
<tref>
yes I follow
<eam>
so I have [2, 59]
dellavg_ has joined #ruby
<eam>
if I'm doing this right, which I'm not sure I am
<eam>
then map [2, 59].map { |digit| that_mapping_above[digit] }.join ""
<eam>
which should be the string representation
snow2222 has quit [Ping timeout: 246 seconds]
Guest53 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
freerobby has quit [Quit: Leaving.]
<eam>
going the other way, you need to map the single characters to the digit between 0..64, and then multiply by 65**(whatever place you're in)
Yzguy has joined #ruby
<tref>
2X
<eam>
so this would be "1v" I think?
<eam>
for 12345
<tref>
yeah 1v
FungalRaincloud has quit [Ping timeout: 272 seconds]
<tref>
eam: sorry forgot to sort it
<eam>
yeah make sure you have a stable ordering :)
<tref>
im using that_mapping_above = [*'0'..'9', *'a'..'z', *'A'..'Z', "_", "."].sort!{|a,b| a <=> b}
hxegon_ has joined #ruby
<eam>
throw - in as well
rodfersou has joined #ruby
akem has quit [Quit: Bye]
EmeraldExplorer has left #ruby [#ruby]
agit0 has joined #ruby
<tref>
sure
everbot has joined #ruby
<tref>
that will give me 65
chrislotix has quit [Read error: Connection reset by peer]
<eam>
I think 65 characters is your max for url safe
<tref>
yeah
<eam>
base64 uses one character for pad
maletor has joined #ruby
<tref>
I have to refresh my knowledge of base64 encoding
hxegon has quit [Ping timeout: 240 seconds]
<eam>
what you're doing here isn't base64 btw
nettoweb has joined #ruby
<Ox0dea>
It's called positional numbering.
lemondom has joined #ruby
<lemondom>
so I used rbenv, now I try out rvm
<lemondom>
ha, I am so excited already
<lemondom>
I let it install right now
<lemondom>
I heard rvm can compile to binary or something like that and is faster then?
fschuindt has quit [Read error: Connection reset by peer]
<eam>
String#next is super weird, depending on the contents of the string
podman has joined #ruby
<Ox0dea>
tref: Do you know how to convert to and from hexadecimal in your head?
purplexed- has joined #ruby
purplexed- has joined #ruby
<Ox0dea>
Or on paper or whatever.
<tref>
Ox0dea: ha - no
Gi0 has quit [Quit: None]
<tref>
Ox0dea: could probably learn real quick
<Ox0dea>
tref: Well, you should learn how to do that, and then extrapolate from 16 to 65, or indeed any n.
_djbkd has quit [Remote host closed the connection]
<lemondom>
utf-8 codepoint is hex
<lemondom>
ehh
<lemondom>
unicode code point
dellavg_ has quit [Ping timeout: 260 seconds]
mloy has joined #ruby
<Ox0dea>
tref: ∀ n ∈ ℝ: 10ₙ = n₁₀
<Ox0dea>
Except, technically, n = {0, 1}, which saddens me.
<tref>
Ox0dea: That’s a little beyond my knowledge
<tref>
Ox0dea: not sure if you caught the beginning of this but were trying to make this url safe
<Ox0dea>
tref: "10 in base n == n in base 10 for all n".
<Ox0dea>
tref: So you choose a URL-safe "alphabet".
<Ox0dea>
The alphabet for hexadecimal is "0123456789abcdef".
<tref>
right which we defined as [*'0'..'9', *'a'..'z', *'A'..'Z', "_", ".","-"]
<Ox0dea>
tref: Now learn how to convert to and from hexadecimal, and then use your alphabet instead.
<finisherr>
I figured it out
<finisherr>
i’m passing in an array looping through each item and grabing the value of the original hash until the array is empty, which leaves me with the value I want
yfeldblum has quit [Ping timeout: 240 seconds]
<Ox0dea>
tref: Mind, hexadecimal is just another system of positional notation, so you're already good to go if you grok how decimal works.
mistermocha has joined #ruby
<hxegon_>
If you assign a lambda to a variable, is it still an anonymous function?
baroquebobcat has joined #ruby
bigmac_ has joined #ruby
n_blownapart has joined #ruby
hxegon_ is now known as hxegon
<Ox0dea>
hxegon_: Its name is still detached from its essence, which can't be said for methods.
momomomomo has quit [Ping timeout: 240 seconds]
Guest53 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Ox0dea>
You can't get hold of a method without knowing its name.
n_blownapart has quit [Client Quit]
<hxegon>
Ox0dea: makes sense
mingle has joined #ruby
hxegon has quit [Quit: leaving]
zenguy_pc has quit [Ping timeout: 268 seconds]
i8igmac has quit [Ping timeout: 264 seconds]
aevitas has joined #ruby
mingle has left #ruby [#ruby]
<shevy>
what about methods without a name
blackmesa has joined #ruby
<Ox0dea>
shevy: Could you provide an example?
mistermocha has quit [Ping timeout: 265 seconds]
<Ox0dea>
(See what I did there?)
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
davedev2_ has quit [Ping timeout: 246 seconds]
_djbkd has joined #ruby
davedev24 has joined #ruby
sdothum has joined #ruby
gusTester has joined #ruby
rikkipitt has quit [Remote host closed the connection]
nertzy has quit [Quit: This computer has gone to sleep]
gix has quit [Quit: Client exiting]
dellavg_ has joined #ruby
kadoppe has quit [Ping timeout: 252 seconds]
duckpuppy has quit [Ping timeout: 255 seconds]
momomomomo has joined #ruby
aevitas has quit [Ping timeout: 272 seconds]
kadoppe has joined #ruby
freerobby has joined #ruby
EllisTAA has joined #ruby
<tref>
Ox0dea: what was wrong with the way we were doing it
spider-mario has joined #ruby
gix has joined #ruby
ta has quit [Ping timeout: 256 seconds]
<Ox0dea>
tref: You were missing the forest.
Musashi007 has quit [Quit: Musashi007]
<Ox0dea>
Understanding how to convert to and from any base is something every programmer should.
axl_ has quit [Quit: axl_]
ldnunes has quit [Quit: Leaving]
prestorium has quit [Quit: Leaving]
colegatron has quit [Ping timeout: 255 seconds]
zenguy_pc has joined #ruby
Jackneill has joined #ruby
hippyphysicist has joined #ruby
davedev24 has quit [Ping timeout: 246 seconds]
troulouliou_dev has joined #ruby
<Ox0dea>
tref: Would you like a fish? :/
G186 has joined #ruby
Motoservo has joined #ruby
<eam>
let's be honest, fishing is an extremely unproductive use of my time
<slash_nick>
Ox0dea: do you have any 3's
<eam>
but if it's fishing for compliments I'm gonna do it anyway
x-light has quit [Ping timeout: 244 seconds]
<Ox0dea>
tref: Please do take some time to understand how this works. https://eval.in/460371
diegoviola has joined #ruby
hippyphysicist has quit [Client Quit]
hippyphysicist has joined #ruby
ruurd has joined #ruby
beauby has quit [Ping timeout: 264 seconds]
jamesaxl|2 is now known as jamesaxl
lemondom has quit [Quit: ChatZilla 0.9.92-rdmsoft [XULRunner 35.0.1/20150122214805]]
Motoservo has left #ruby [#ruby]
eminence_ has quit [Ping timeout: 250 seconds]
davedev24 has joined #ruby
sankaber has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Guest53 has joined #ruby
<tref>
Ox0dea: No, sorry I’m vega
<tref>
vegan* lol
<shevy>
Ox0dea ->
civil_ has quit [Ping timeout: 265 seconds]
SylarRuby has joined #ruby
<Ox0dea>
shevy: That's not a valid method name in Ruby.
aspiers has joined #ruby
rbennacer has quit []
<shevy>
you can .call it
hippyphysicist has quit [Quit: Leaving]
<Ox0dea>
That makes it a method?
blt has joined #ruby
<shevy>
one without a name
<Ox0dea>
You don't usually troll...
<shevy>
You do usually troll...
hxegon has joined #ruby
umgrosscol has quit [Quit: End of Line]
<havenwood>
Happy Frejya's Day!
jackjackdripper has quit [Ping timeout: 268 seconds]
<shevy>
and that name is a very strange one for the USA
<Ox0dea>
shevy: UnboundMethod instances have names, they're just not bound.
colegatron has joined #ruby
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<shevy>
can I unbound a method from -> ?
rbennacer has joined #ruby
<Ox0dea>
shevy: "Unbound" is an adjective, not a verb.
<Ox0dea>
UnboundMethod doesn't have a constructor, so no, you cannot create one from a lambda.
codecop has quit [Read error: Connection reset by peer]
nettoweb has joined #ruby
<shevy>
but a lambda is an object
InternetFriend has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
Motoservo has quit [Read error: Connection reset by peer]
hippyphysicist has joined #ruby
hippyphysicist has quit [Client Quit]
zotherstupidguy has quit [Quit: WeeChat 1.3]
babblebre has quit [Quit: Connection closed for inactivity]
Motoservo has joined #ruby
radgeRayden has joined #ruby
<tref>
Ox0dea: going through your example. Excuse my ignorance but I’m having a hard time finding any information on the syntax you used: `while (number /= charset_size) > 0`
rbennacer has quit [Remote host closed the connection]
ruurd has quit [Quit: ZZZzzz…]
atomical has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
anisha has quit [Quit: Leaving]
<itgold>
the item's class ?
rbennacer has joined #ruby
<Eiam_>
itgold: what are you really trying to do because the question has shifted slightly
<Eiam_>
do you want to add a new attribute or method to all instances and future instances of a class?
mag42c has quit [Quit: mag42c]
<Eiam_>
basically, extend the class definition
<Eiam_>
or are you just trying to add a value into a specific instance of a specific object
arup_r has quit [Quit: Leaving]
<itgold>
I'm playing around with the logstash plugin that is pulling data from RSS feed and populates Elasticsearch index. For one of the feeds I have there is no property that it expects and it is pubDate. I'm trying to patch RSS plugin source code so if there is no pubDate property it just needs to ignore it
<Eiam_>
open up the class and add a method for pubDate that returns whatever you expect/want
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rbennacer has quit [Ping timeout: 246 seconds]
<itgold>
aha, let me check if I have this class
trosborn has joined #ruby
<Eiam_>
effectively making it a runtime patch
<Eiam_>
you don't need the class source code
<Eiam_>
just literally define it in your code
blackmesa has joined #ruby
bruno- has quit [Ping timeout: 260 seconds]
<Eiam_>
class Blah def pubDate :noValue end end
<itgold>
not sure I understand how to do it
swgillespie has joined #ruby
to_json has joined #ruby
to_json has joined #ruby
aspiers has quit [Ping timeout: 250 seconds]
<itgold>
I have a variable called "item"
<itgold>
my understanding is I need to add pubDate to this instance somehow
<Jerrod>
add it to the class.
joncol has quit [Quit: leaving]
<Eiam_>
class Item def pubDate :value end end
swgillespie has quit [Read error: Connection reset by peer]
<itgold>
ah
<Eiam_>
variable isn't relevant, its the class of what it is
<Eiam_>
itgold: when you create a class.. re "defining" the class just adds into the class definition
<Eiam_>
so "class Test def hi puts "hello" end end" "class Test def hello puts "hi" end end" x = Test.new will give you x.hi and x.hello
mordocai has quit [Read error: Connection reset by peer]
<Eiam_>
only need to define it once; not in a loop
dmitch has quit [Ping timeout: 240 seconds]
<Jerrod>
itgold, do you understand the relationship between Classes and Instances?
<itgold>
Jerrod: I think I do :)
rbennacer has joined #ruby
postmodern has joined #ruby
<Jerrod>
The class is a blue print object in which an instance is created from, if you want to add a property to an instance, add it to the class and it each new instance will be created with the new property.
naftilos76 has joined #ruby
<Eiam_>
itgold: do your monkeypatch at load
al2o3-cr has quit [Ping timeout: 252 seconds]
<itgold>
yes
<Eiam_>
itgold: whats item.class say
hahuang65 has quit [Ping timeout: 240 seconds]
<itgold>
let me check
ss_much has joined #ruby
p0wn3d__ has quit [Ping timeout: 260 seconds]
ESpiney has quit [Quit: Leaving]
ehth77 has joined #ruby
jackjackdripper has joined #ruby
momomomomo has joined #ruby
newdan has quit [Ping timeout: 250 seconds]
al2o3-cr has joined #ruby
solocshaw has quit [Ping timeout: 246 seconds]
<itgold>
:item=>RSS::Rss::Channel::Item
tigarcia has quit [Remote host closed the connection]
<itgold>
I do need to have RSS::Rss::Channel::Item class in order to patch it, right?
EllisTAA has joined #ruby
lemondom has joined #ruby
x-light has joined #ruby
quazimodo has quit [Ping timeout: 255 seconds]
<lemondom>
Can/do I have to upgrade gem itself? I installed a ruby version - is gem current then?
rikkipitt has joined #ruby
finisherr has joined #ruby
<shevy>
what is the new gem version
<shevy>
latest one should be 2.4.8
<itgold>
'''
<lemondom>
2.4.8
<lemondom>
yes
<lemondom>
current stable ruby
<lemondom>
I use rvm
<shevy>
\o/
gix has quit [Quit: Client exiting]
sandals has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<lemondom>
to install bundler globally, I just run gem install?
<itgold>
here is how I get list of items: feed = RSS::Parser.parse(body) feed.items.each do |item|
<lemondom>
no need for a -g switch, right?
beauby has quit [Ping timeout: 260 seconds]
<havenwood>
lemondom: Just: gem install bundler
xantik has joined #ruby
<Eiam_>
sounds like a module
<itgold>
I was hoping to add pubDate to every item object instance if it doesn't exists
<lemondom>
cool
<lemondom>
I love bundler
<lemondom>
I love Gemfiles and bundler
<lemondom>
I just run bundler install and I am done
<lemondom>
hurra
<djellemah>
itgold: does item[:pubDate] or item['pubDate'] do something useful?
<havenwood>
lemondom: RubyGems even supports creating/updating a Gemfile.lock from your Gemfile: gem install -g
<itgold>
no, I assume this is just suppose to be a property. This is how it is getting used: event["published"] = item.pubDate
<lemondom>
havenwood: so it replaces bundler now?
<havenwood>
lemondom: Then to be in the context of the bundle just set: export RUBYGEMS_GEMDEPS=-
<lemondom>
what does gem install -g? globally install ?
allomov has joined #ruby
<djellemah>
itgold: there are no properties in ruby, only methods.
<itgold>
oh
<itgold>
that is what I was missing
<itgold>
so item.pubDate is a getter or something?
<lemondom>
havenwood: so I don't need bundle anymore?
gix has joined #ruby
rbennacer has quit [Remote host closed the connection]
swgillespie has quit [Remote host closed the connection]
rbennacer has joined #ruby
<itgold>
can I dynamically add a new method pubDate to every item that has no such method?
but3k4 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Eiam_>
djellemah: mmm I don't know that statement is correct?
arthurix_ has joined #ruby
yfeldblum has joined #ruby
<Eiam_>
djellemah: objects have properties /attributes
<Eiam_>
djellemah: and methods are how you access them
dellavg_ has quit [Ping timeout: 260 seconds]
<djellemah>
Eiam_: you mean instance variables?
<itgold>
Eiam: maybe he meant that when you access a property you do this trough method?
jessemcgilallen has quit [Quit: jessemcgilallen]
malconis has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Yzguy has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Eiam_>
djellemah: class Test def initialize @test = "hi" end end Test has an attribute, @test
swgillespie has joined #ruby
<Eiam_>
@test is not a method
<djellemah>
Eiam: not accessible from the outside.
<Eiam_>
djellemah: if you define an accessor it is
Musashi007 has quit [Quit: Musashi007]
<Eiam_>
attr_reader :color
eminencehc has joined #ruby
<itgold>
unless (item.pubDate rescue nil).nil?
<Eiam_>
err, attr_reader :test
<djellemah>
Eiam: attr_reader defines the method for you.
<itgold>
this is how I check if pubDate exists
<djellemah>
itgold: item.pubDate if item.respond_to? :pubDate is probably the easiest
<itgold>
but can I then add it to this particular instance?
arthurix has quit [Ping timeout: 240 seconds]
<Eiam_>
djellemah: right, it defines a method.. to an attribute/property/.. instance variable =0
<Eiam_>
djellemah: thats not what hes trying to do. he knows pubDate doesn't exist. he wants to make it exist and do something
<djellemah>
do what?
<itgold>
right!
jessemcgilallen has joined #ruby
diegoviola has quit [Ping timeout: 246 seconds]
<itgold>
just access it
<itgold>
event["published"] = item.pubDate
<itgold>
like that
<djellemah>
So it it doesn't exist, nil is fine, right?
<Eiam_>
itgold: and what should pubDate return
rbennacer has quit [Ping timeout: 264 seconds]
<itgold>
I want it to return empty something
<Eiam_>
nil to indicate state is bad but w/e
cdg has joined #ruby
Gi0 has quit [Quit: None]
<itgold>
empty string would work
<Eiam_>
so is that
rakm has joined #ruby
<djellemah>
event["published"] = item.pubDate rescue nil will work, although the rescue is somewhat overkill
<Eiam_>
djellemah: that forces every instance to evaluate
<itgold>
oh, cool!
<Eiam_>
djellemah: you don't like monkeypatch as a solution?
<itgold>
I think this is exactly what I need
<itgold>
thank you guys!
<Eiam_>
rescue nil is required in every place some other code decides to access the non existent attribute
rbennacer has joined #ruby
lxsameer has quit [Quit: Leaving]
DoubleMalt has joined #ruby
<djellemah>
it seems to solve itgold's problem without a need to understand classes / instances / monkeypatching
<Eiam_>
itgold: all RSS::Rss::Channel::Item classes will return :default_pub_date when accessed now
rbennacer has quit [Ping timeout: 268 seconds]
<itgold>
cool!
mois3x has quit [Quit: mois3x]
<itgold>
but do I have to modify Item's class for this?
<Eiam_>
(you cannot SET a value, but atleast now your string comes from a known place)
<Eiam_>
itgold: which is what the example is doing on lines 23-27
<Eiam_>
yes. thats correct.
solocshaw has joined #ruby
n008f4g_ has quit [Quit: leaving]
<Eiam_>
the difference is, if LATER you need to access pubDate again, you have to start rescuing there too. and rescue for every access seems like an odd expense to pay but
* Eiam_
shrugs
<itgold>
got it. And this way I don't have to use "rescue"
<Eiam_>
djellemah: I was reading through it, seemed like a possible solution
<itgold>
thank you, Eiam_
dellavg_ has joined #ruby
<Eiam_>
djellemah: I figure I'm not the first person to have this question so I was wondering what peole were d oing
<Eiam_>
itgold: thats correct that you do not. It's all trade offs. djellemah solution does some things, not others. mine has its own trade offs.
<Eiam_>
using nil or empty strings or arrays to indicate state is "usually" a poor practice, because that state couuld be set ANYWHERE
<djellemah>
Eiam: Somebody I know likes dotenv. I haven't really used it.
hahuang65 has joined #ruby
bruno- has joined #ruby
mikeharris22 has quit [Remote host closed the connection]
x-light has quit [Ping timeout: 250 seconds]
<Eiam_>
djellemah: thanks.. so far it was the closest to what I was after.. scattered stuff in config.ru, sinatra.app and all my model/init.rb files so trying to centralize it in some places
devbug has quit [Read error: Connection reset by peer]
<Eiam_>
Rake defines a DB, but so does Models/init.rb
Sceko has joined #ruby
<Eiam_>
and so does config.ru =0
devbug has joined #ruby
<Eiam_>
(all entry points into points of development or production!)
rikkipitt has quit [Remote host closed the connection]
minimalism has quit [Ping timeout: 255 seconds]
quazimodo has joined #ruby
Jerrod has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
bMalum has joined #ruby
rikkipitt has joined #ruby
bb010g has quit [Quit: Connection closed for inactivity]
bMalum has quit [Client Quit]
hxegon has quit [Ping timeout: 264 seconds]
tigarcia has joined #ruby
devoldmx has joined #ruby
A124 has quit [Quit: '']
rikkipitt has quit [Remote host closed the connection]
quazimodo has quit [Ping timeout: 240 seconds]
willardg has joined #ruby
diegoaguilar has quit [Quit: Leaving]
diegoaguilar has joined #ruby
diegoaguilar has quit [Remote host closed the connection]
tref has quit [Quit: tref]
uri_ has quit [Ping timeout: 250 seconds]
moeabdol1 has quit [Ping timeout: 246 seconds]
nfk|laptop has quit [Quit: yawn]
devoldmx has quit [Ping timeout: 246 seconds]
momomomomo_ has joined #ruby
Musashi007 has joined #ruby
dnomyar has quit [Ping timeout: 250 seconds]
skweek has quit [Quit: Leaving]
bruno- has quit [Ping timeout: 272 seconds]
momomomomo has quit [Ping timeout: 255 seconds]
momomomomo_ is now known as momomomomo
cdg has quit [Remote host closed the connection]
A124 has joined #ruby
jackjackdripper has quit [Ping timeout: 264 seconds]
<Ox0dea>
itgold: Well, that was a weird error, but the RSS standard library has had this #pubDate method on Item since 1.8, so your error must be in another castle.
patdohere has joined #ruby
sdfgsdfg has quit [Read error: Connection reset by peer]
<Ox0dea>
itgold: Then you were mistaken in your conclusion that you were invoking #pubDate on an instance of RSS::Rss::Channel::Item.
DoubleMalt has quit [Remote host closed the connection]
TheNet has joined #ruby
<Ox0dea>
itgold: Oh, you'll want to remove Eiam's patch and try again.
<itgold>
how can we confirm that?
<itgold>
I didn't do Eiam's patch
<Ox0dea>
Then it's confirmed.
shun_ has joined #ruby
<itgold>
but :item => item.class prints out :item=>RSS::Rss::Channel::Item
<hahuang65>
when building a gem, is it possible to specify the output name?
<itgold>
what does respond_to do?
mikeharris22 has quit [Remote host closed the connection]
mikeharris22 has joined #ruby
<shevy>
itgold whether your object responds to the given method
<Ox0dea>
hahuang65: Name your gemspec appropriately?
freerobby has quit [Quit: Leaving.]
<hahuang65>
Ox0dea: what do you mean?
<Ox0dea>
hahuang65: How are you building your gem?
<itgold>
why respond_to(:pubDate) returns true but item.pubDate throws an exception?
<Ox0dea>
> undefined method `pubDate' for #<RSS::RDF::Item:0x77913237>
hiyosi has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Ox0dea>
itgold: That was the error you originally mentioned.
jericon has joined #ruby
<hahuang65>
so I'm building it like `gem build my-gem.gemspec` and it outputs as `my-gem-0.0.1.gem` where I want to name it `my-gem.gem` without the version
<Ox0dea>
itgold: Do you have an RSS:RDF::Item, or do you have an RSS::Rss::Channel::Item?
<itgold>
ah, maybe. So this is another type of class?
<jericon>
Is there any Ruby function that would give a result similar to mysql's "to_days" function (Days since year 0).
<Ox0dea>
hahuang65: Why?
<Ox0dea>
jericon: From what kind of input?
<shevy>
hahuang65 interesting. you can get rid of the version suffix if you assign .version = ''
<shevy>
but a trailing - will be kept :\
<hahuang65>
Ox0dea: this is going in a Dockerfile and I don't want to change the version number in the Dockerfile each time we upgrade.
duncannz has joined #ruby
dfockler has joined #ruby
<hahuang65>
shevy: hmmm that might be okay...
<itgold>
let me check it again
duncannz has quit [Max SendQ exceeded]
minimalism has joined #ruby
<itgold>
I'm seen :item=>RSS::Rss::Channel::Item
duncannz has joined #ruby
<jericon>
Ox0dea: a dateTime. I'm working on a script to do some management in mysql with partitions. the partitions are done by to_days(now()) basically.
Lucky__ has joined #ruby
<shevy>
hahuang65 you may possibly be the first one with such a request, you can file an issue request for being able to omit the "-version" suffix, or perhaps when .version = '' was set to empty specifically; issue requests can go to: https://github.com/rubygems/rubygems/issues
<Ox0dea>
jericon: An instance of Ruby's DateTime, or?
<jericon>
Ox0dea: yes.
<jericon>
I can select that value from MySQL and store that in a ruby variable, but I was wondering if there was a function in ruby that would give me the same thing.
allomov has joined #ruby
<itgold>
but an error says: Error: undefined method `pubDate=' for #<RSS::RDF::Item:0x4468f24f>\n Exception: NoMethodError\n Stack: /opt/logstash-1.5.4/vendor/bundle/jruby/1.9/gems/logstash-input-rss-0.1.4/lib/logstash/inputs/rss.rb:56
lemondom has quit [Ping timeout: 244 seconds]
<itgold>
why can't I do this to avoid this error: item.pubDate = item.pubDate rescue nil ?
lemondom has joined #ruby
<itgold>
I want to initialize actually item.pubDate because it is used somewhere else down the chain
<itgold>
instead of doing event["published"] = item.pubDate recover nil
<hahuang65>
shevy: thanks :)
DiCablo has joined #ruby
<itgold>
probably I should do Eiam's solution to make it right
gregoriokusowski has quit [Quit: gregoriokusowski]
<Ox0dea>
itgold: You should determine why you have an RSS::RDF::Item even though your log says you have an RSS::Rss::Channel::Item.
karapetyan has quit [Remote host closed the connection]
last_staff has quit [Quit: last_staff]
karapetyan has joined #ruby
shun_ has quit []
htmldrum has joined #ruby
stamina has quit [Ping timeout: 264 seconds]
TheNet has quit [Remote host closed the connection]
<Ox0dea>
Something to do with the switch to Julian, I'm sure.
Musashi007 has joined #ruby
<Ox0dea>
*Gregorian
<jericon>
Probably. I'll probably just use the first example you gave and add a -2 until I can figure out a better way to get it. Or just select it out of MySQL and use that value.
<itgold>
so it is just the matter of instance type that is getting used. I'm getting both types from different sources
craysiii has quit [Remote host closed the connection]
htmldrum has quit [Ping timeout: 265 seconds]
A124 has quit [Quit: '']
<itgold>
and the problem is only with this class: RSS::RDF::Item
lemondom_ has joined #ruby
A124 has joined #ruby
<Eiam>
yeah, those types are different because your objects are different
<Eiam>
gotta run
mary5030 has quit [Remote host closed the connection]
<itgold>
Ox0dea: :item => item.respond_to?(:pubDate) resolves to false in case of this is RSS::RDF::Item
<Ox0dea>
itgold: It seems the author of that Logstash plugin just didn't account for the fact that RSS::Parser.parse(foo).feed_type == 'rss', even if `foo` was actually an RDF feed.
<itgold>
yeah, I'd like to avoid introducing additional libraries
ibouvousaime has joined #ruby
diegoaguilar has quit [Remote host closed the connection]
Musashi007 has quit [Quit: Musashi007]
<itgold>
maybe
<itgold>
so Ruby is a dynamic language, can I do this default value initialization?
TheNet has joined #ruby
<itgold>
on the instance level
riotjon__ has quit [Ping timeout: 246 seconds]
<Ox0dea>
itgold: `def item.pubDate; :whatever; end`, and may the fates have mercy on your foot.
<jhass>
that's a horrible suggestion
<Ox0dea>
It's what the customer wants.
<zenspider>
"how do I do this" ?
finisherr has quit [Quit: finisherr]
<itgold>
even horrible would work for me, guys :)
wldcordeiro has quit [Ping timeout: 272 seconds]
<jhass>
well, pretty sure they want to keep the data if present
naftilos76 has quit [Remote host closed the connection]
<Ox0dea>
Oh, I forgot that part.
<jhass>
looks like a method_missing hook, meh
<Ox0dea>
itgold: Are you sure you don't want to figure out why you're getting RSS::RDF::Items where you're expecting RSS::Rss::Channel::Items?
<jhass>
the rss stdlib is horrible, who did ever accept that in?
<zenspider>
standards were lower 15 years ago :)
<zenspider>
I would love to see a revamping of stdlib
<itgold>
Ox0dea: I think I've figured out. This method just accept both types. And it breaks on RSS::RDF::Items
<jhass>
Item or Items?
<jhass>
both exist
<Ox0dea>
Lovely.
<itgold>
Items is a list of item variables
<fibbel>
itgold: so the issue is line 74 errors if the datasource doesn’t have pubDate?
<itgold>
yes, if item.pubDate is undefined
<fibbel>
and you can’t fork that code and submit a patch with a “.try(:pubDate) || Time.now” ?
<fibbel>
or whatever the time should be
<fibbel>
* er pubDate
<jhass>
fibbel: you checked activesupport is loaded?
<Ox0dea>
itgold: That branch of the `case` statement wouldn't be executed if `feed.feed_type` weren't returning "rss" when it probably shouldn't.
<fibbel>
ah jhass yes spoiled by rails
<fibbel>
so this is ruby only?
<itgold>
I think this is ruby only
firstdayonthejob has quit [Ping timeout: 240 seconds]
devoldmx has joined #ruby
<jhass>
itgold: okay, no method_missing magic after all, RSS09::Item and RSS20::Item alias date to pubDate, however RDF does define date too
<jhass>
itgold: so item.date instead of item.pubDate should work
<itgold>
and I'm looking at Ruby code second time in my life, so I'm just noob, sorry
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
dellavg_ has quit [Ping timeout: 260 seconds]
tref has quit [Quit: tref]
<itgold>
jhass, interesting, I can give it a try. But I believe it might depend on a specific rss feed that I'm working with. Some of them has pubDate some not
mary5030 has quit [Remote host closed the connection]
alfie_max15 has joined #ruby
<jhass>
yeah, I just explained why and that I think all of them have data and that pubDate is the same as date for all that have pubDate
<zenspider>
you'd rather have no date at all... wtf
pwnd_nsfw has quit [Ping timeout: 240 seconds]
dopie has quit [Quit: Leaving]
<jhass>
itgold: throw it away, go back to the version on github
<jhass>
itgold: replace item.pubDate with item.date
akkad has quit [Excess Flood]
<itgold>
author also breaks the same way
akkad has joined #ruby
mary5030 has quit [Ping timeout: 252 seconds]
<itgold>
let me try date
<jhass>
itgold: replace item.author with item.respond_to?(:author) ? item.author : "" then
noodle has joined #ruby
shazaum_ has joined #ruby
TheNet_ has joined #ruby
<itgold>
jhass, I don't like that
I has joined #ruby
I has quit [Remote host closed the connection]
<jhass>
itgold: now I'm thrilled on hearing your arguments against using the author if available
tref has joined #ruby
SenpaiSilver has quit [Quit: Leaving]
<zenspider>
this has flipped my bozo bit.
to_json has quit [Quit: Leaving.]
<zenspider>
non-bozo \ bozo
<zenspider>
non-bozo / bozo
<itgold>
I want to modify an original object, if I just pass in pubDate and author in this particular case to an event it is trowing an error somewhere else down the invocation chain
<itgold>
it is throwing an error from another class, looks like somebody else is holding a reference
Musashi007 has joined #ruby
<jhass>
as said, item is not passed anywhere, neither is feed
TheNet has joined #ruby
<jhass>
from everything you've shown at least
Musashi007 has quit [Client Quit]
TheNet_ has quit [Read error: Connection reset by peer]
purplexed- has quit [Ping timeout: 240 seconds]
<itgold>
yes, you are right
<itgold>
maybe it is parsing an input source somewhere else
htmldrum has joined #ruby
patdohere has joined #ruby
pwnd_nfsw has quit [Ping timeout: 246 seconds]
towski_ has quit [Remote host closed the connection]
<TheNet>
eam: hey thanks for the benchmark suggestion earlier regarding debug logging! I ran a benchmark and found that passing a block into the debug method was faster than both sprintf, and no block (except of course when debug was enabled where the standard, no block no sprintf method ruled supreme).
<zenspider>
TheNet: may I see?
<itgold>
yeah, it is still failing even if I modify original object
<itgold>
Plugin: <LogStash::Inputs::Rss interval=>1800, url=>\"http://www.checkpoint.com/defense/advisories/public/smartdefense_atomz.xml\", tags=>[\"rss\"], type=>\"checkpoint\", debug=>false, codec=><LogStash::Codecs::Plain charset=>\"UTF-8\">>\n Error: value <Sat, 7 Mar 2015 0:30:37 UTC> of tag <pubDate> is not available.\n Exception: RSS::NotAvailableValueError\n Stack: /opt/logstash-1.5.4/vendor/jruby/lib/ruby/1.9/rss/0.9.rb:107:in `pubD
whippythellama has quit [Quit: WeeChat 1.3]
<zenspider>
all of the items in that feed have pubDate entries
<jhass>
itgold: post the full output to gist.github.com
htmldrum has quit [Ping timeout: 246 seconds]
<jhass>
itgold: you're lucky that your client truncated the message
bigmac_ has quit [Ping timeout: 240 seconds]
<zenspider>
and that datetime parses w/ Time.parse