fflush has quit [Remote host closed the connection]
benson has quit [Remote host closed the connection]
artOfWar has quit [Remote host closed the connection]
luckyruby has joined #ruby
nari has quit [Ping timeout: 244 seconds]
paradoja has quit [Remote host closed the connection]
Taichou has joined #ruby
jhowarth has joined #ruby
Taichou_ has joined #ruby
SCommette has joined #ruby
Taichou has quit [Ping timeout: 245 seconds]
<crazed>
if i have a module Foo::Bar, is there an easy way to get the direct parent? in this case Foo? i realize i can do some split magic, but was looking for something more elegant
SeanTAllen has quit [Max SendQ exceeded]
moshee has quit [Ping timeout: 248 seconds]
jjang has quit [Remote host closed the connection]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
dotemacs has quit [Max SendQ exceeded]
moeSeth has quit [Ping timeout: 245 seconds]
jhowarth has quit [Max SendQ exceeded]
philcrissman has quit [Ping timeout: 240 seconds]
aquaranto has quit [Ping timeout: 245 seconds]
banisterfiend has joined #ruby
randym has quit [Ping timeout: 245 seconds]
kapowaz has quit [Ping timeout: 246 seconds]
chrxn_ has joined #ruby
Banistergalaxy has quit [Ping timeout: 248 seconds]
<cirwin>
crazed: if you're inside the module you can run Module.nesting; otherwise no
<zastern>
Silly question maybe, but - when I set a variable equal to the contents of a file, e.g. foo File.open(filename), what EXACTLY am I setting the variable equal to? I mean, it's not a string, it's not an integer, what is it?
ringotwo has quit [Remote host closed the connection]
dhruvasa1ar has joined #ruby
dhruvasagar has quit [Ping timeout: 246 seconds]
<zastern>
foo = rather
mascool has quit [Ping timeout: 250 seconds]
foEs has joined #ruby
jonathanwallace has quit [Remote host closed the connection]
<cirwin>
it's a File object
<cirwin>
if you open up a REPL (like irb, or pry) you can play around with questions like that
<banisterfiend>
are there any file objects that hang around in an irb session
<banisterfiend>
File
<havenn>
zastern: foo = File.open('filename'
<havenn>
zastern: oops, early return..
<zastern>
yes, that is what I meant to write
<zastern>
same question though
mxweas has joined #ruby
chimkan has joined #ruby
<havenn>
zastern: If you look at foo.class you'll see as cirwin said it is File.
<havenn>
zastern: use Pry imho, then cd into foo/
<zastern>
So "file data" is a data type unto itself?
sent-hil has quit [Remote host closed the connection]
<cirwin>
zastern: File is a class
<zastern>
i dont know what the things you are saying mean :)
<zastern>
im just learning
<cirwin>
it's not the file data
<cirwin>
you need to call File#read to get the data
<al2o3cr>
davidcelis: ["TypeError: can't convert String into Integer"]
<fowl>
jrajav: what other bot works like that? even the one in #Lua just returns the result. when you do "x = 3; x * 2" in ruby you dont get [3, 6] you get 6
<davidcelis>
sigh
<banisterfiend>
>> $stdout.class.ancestors
<al2o3cr>
banisterfiend: nil
<cirwin>
interesting
<jrajav>
davidcelis: STDIN is a known issue, I'll fix it when I get back to work
<davidcelis>
lol
<davidcelis>
>> ಠ_ಠ
<al2o3cr>
davidcelis: The Ruby interpreter exited with a nonzero status. Hanmac is probably to blame.
<jrajav>
fowl: Some would say that having more information is a good thing?
<cirwin>
>> def ಠ_ಠ; :yawn; end
<al2o3cr>
cirwin: The Ruby interpreter exited with a nonzero status. Hanmac is probably to blame.
<fowl>
davidcelis: you are bot can be hated on too so watch it
<cirwin>
>> class << ARGF.to_write_io; binread(__FILE__); end
havenn has joined #ruby
<jrajav>
fowl: I think you're taking it too pedantically. Of course those expressions don't produce *arrays* if that's what you mean. That's not the point, the array is just for display
<jrajav>
It's outside the fourth wall if you will
d3vic3 has joined #ruby
<banisterfiend>
>> class << ARGF.to_write_io; binread(__FILE__); end
<fowl>
>> (0..3).map { |x| x * 2 }
<al2o3cr>
fowl: [[0, 2, 4, 6]]
<banisterfiend>
jrajav: it's annoying
delinquentme_ has joined #ruby
<banisterfiend>
jrajav: cos it means you can't do this: def hello; :hello; end; hello
<fowl>
its misleading, in the least
<cirwin>
>> ARGF.to_write_io
<al2o3cr>
cirwin: ["IOError: not opened for writing"]
<banisterfiend>
jrajav: since u break up expressions by ';' and then return the result prior to each ';'
adeponte has joined #ruby
<jrajav>
So you'd prefer just printing the last index in the array?
<banisterfiend>
jrajav: it makes mutli-line expressions impoossible
<jrajav>
banisterfiend: All I can say is that everything is just piped straight into vanilla Ruby and run, minus unsafe constants and methods like Kernel, eval, etc.
<davidcelis>
tent4051: did you even click the fuggin' "install" link
<havenn>
tent4051: gem install rush
<davidcelis>
tent4051: ಠ_ಠ
<jrajav>
banisterfiend: If you can't do something, you probably actually can't do something
<banisterfiend>
jrajav: but you seem to be breaking up input by ';', no? cos you return results like thos: [result1, result2]
<fowl>
>> "hello;there"
<al2o3cr>
fowl: ["SyntaxError: sandrbox:1: unterminated string meets end of file", "SyntaxError: sandrbox:2: unterminated string meets end of file"]
brcfg is now known as textinfo
<jrajav>
banisterfiend: Everything's still in the same scope
<davidcelis>
LOL
textinfo is now known as terminfo
<davidcelis>
>> "this; is; broken"
sebastorama has quit [Quit: Computer has gone to sleep.]
<banisterfiend>
jrajav: look at fow's example there :) it looks like you're really just splitting the input string by ";"
<davidcelis>
["SyntaxError: sandrbox:1: unterminated string meets end of file", "NameError: undefined local variable or method `is' for main:Object", "SyntaxError: sandrbox:3: unterminated string meets end of file"]
<davidcelis>
you break up the input string
<jrajav>
huh.
foEs has quit [Remote host closed the connection]
CannedCorn has joined #ruby
<cirwin>
>> define_method(:foo) { }
<al2o3cr>
cirwin: nil
<cirwin>
>> foo
<al2o3cr>
cirwin: ["NameError: undefined local variable or method `foo' for main:Object"]
<fowl>
you can't just split on ; if you are intent on handling each expr you need to use a ruby parser or something wizardly such therein
tent4051 has left #ruby [#ruby]
Guedes has quit [Ping timeout: 245 seconds]
<jrajav>
Take it up with Sandrbox
<jrajav>
It seems to be a bug in that
<banisterfiend>
>> def cirwin() :cirwin end && cirwin
<al2o3cr>
banisterfiend: []
kaichanvong has joined #ruby
<banisterfiend>
oh
<jrajav>
All I'm doing is taking the string after >> and passing it in to Sandrbox.perform
<banisterfiend>
>> def cirwin() :cirwin end || cirwin
<jrajav>
I am honestly confused about this, seriously:
<jrajav>
>> "why; is; this; broken"
<jrajav>
["SyntaxError: sandrbox:1: unterminated string meets end of file", "NameError: undefined local variable or method `is' for main:Object", "NameError: undefined local variable or method `this' for main:Object", "SyntaxError: sandrbox:4: unterminated string meets end of file"]
<davidcelis>
cirwin: two semicolons is the same length as ()
<cirwin>
davidcelis: you don't need one at the end, even I know that :p
<banisterfiend>
jrajav: cos, what it's doing is splitting on ";" and treating each part as a separate expression, it then returns the reult of each expression in the output array
<al2o3cr>
cirwin: The Ruby interpreter exited with a nonzero status. Hanmac is probably to blame.
<banisterfiend>
jrajav: watch
<davidcelis>
jrajav: apparently Sandrbox just splits on a semicolon
mramaizng has joined #ruby
<banisterfiend>
>> 1; 2; 3; 4; 5
<al2o3cr>
banisterfiend: [1, 2, 3, 4, 5]
<banisterfiend>
>> 1 + 1; 2 + 2
<al2o3cr>
banisterfiend: [2, 4]
<fowl>
cirwin: the only place you really need semiconolies is after class or module
<banisterfiend>
jrajav: see? :)
<fowl>
semicanolies*
<cirwin>
fowl: ah ok
<jrajav>
Yeah
<jrajav>
That's a pretty silly oversight
<fowl>
>> (1 + 2; 5)
<banisterfiend>
Yeah, you can probalby just change the delimeter
<heftig>
>> 1 \; 2
<al2o3cr>
heftig: [1, 2]
<banisterfiend>
jrajav: change the split thing to something like: // or so
<fowl>
>> (1 + 2\; 5)
<jrajav>
To be fair to Sandrbox, though, it does what it sets out to do very well: the actual sandboxing
<cirwin>
because open has to happen before you have a file object
<cirwin>
so it's on the File class
<cirwin>
but close makes sense to happen to a particular file object
fbernier has joined #ruby
erichmenge has joined #ruby
<zastern>
oh so when you say file.close, file being the variable that represents said file
octarine has joined #ruby
oz has quit [Quit: bbl]
<zastern>
I guess it makes sense to "happen to the object", but why not have it be part of the general File class just because it's an action you do with files? I guess i'm not understanding why the methods are "organized" this way
mahmoudimus has quit [Client Quit]
jxf has quit [Ping timeout: 255 seconds]
<zastern>
It just would seem to be more consistent to do File.open('file) and then File.close('file')
maletor has quit [Quit: Computer has gone to sleep.]
<zastern>
but i guess there are reasons I don't understand yet
powerplay has joined #ruby
ZachBeta has joined #ruby
dhruvasa1ar has quit [Ping timeout: 246 seconds]
dhruvasagar has joined #ruby
powerplay has quit [Quit: Leaving]
<fowl>
zastern: consider File.close, how would you use it? File.close(file) ? that's not the ruby way
lunitikcalm has joined #ruby
<zastern>
I don't know why. but i dont know much about programming
<cirwin>
mainly because you have to say "file" twice
<powerplay>
havenn: thank you, i am already familiar with nokogiri and have been using it for parsing a web page. i am rather looking for a guide on good scraping practices
jorge has joined #ruby
<cirwin>
powerplay:1) support robots.txt; 2) try not to break anything :p
<cirwin>
(and also be prepared for websites to break you in ways you didn't think was possible)
stephenjudkins has quit [Ping timeout: 246 seconds]
stephenjudkins_ is now known as stephenjudkins
d3vic3 has quit [Quit: leaving]
<powerplay>
cirwin: thank you ive been trying my best to write scrapes that dont break. by the way, are crawling and scraping similar things?
<powerplay>
or is there a difference?
<cirwin>
uh.. they overlapping semantically
<cirwin>
scraping is more about extracting the data whereas crawling is more about requesting the pages
<cirwin>
but you can't do either without some of the other
<cirwin>
CloCkWeRX: @@variables are the hallmark of a level-7 ruby programmer; another few months and that guy will be at level-8 and never look at @@vars again
ZachBeta has quit [Quit: Computer has gone to sleep.]
<fowl>
cirwin: did you just make these levels up
CannedCorn has quit [Client Quit]
<cirwin>
yes
<fowl>
call @@ level 1 then
<cirwin>
nah, people don't use @@ variables to start with because they don't understand them
<cirwin>
so it's at least level 3
<fowl>
do you know if they are dropping them in 2.0
<cirwin>
i know nothing about that
<fowl>
i see
<fowl>
>> Class.new do end.new
<al2o3cr>
fowl: nil
adeponte has quit [Ping timeout: 244 seconds]
<havenn>
>> 1.0/0
<al2o3cr>
havenn: [Infinity]
<fowl>
>> ;;;
<al2o3cr>
fowl: The Ruby interpreter exited with a nonzero status. Hanmac is probably to blame.
<cirwin>
>> Array.new(100).combination(50).count
oz has joined #ruby
deryl has joined #ruby
<powerplay>
havenn: thanks and yea basically im not looking for crawlers but rather looking for a resource that talks about good scraping practices
<havenn>
>> "powerplay: good luck to #{1.0/0}!"
<al2o3cr>
havenn: ["powerplay: good luck to Infinity!"]
fbernier has quit [Ping timeout: 248 seconds]
tewecske has joined #ruby
havenn has quit [Remote host closed the connection]
hadees has quit [Quit: hadees]
dhruvasagar has quit [Ping timeout: 246 seconds]
dhruvasagar has joined #ruby
hadees has joined #ruby
minijupe has joined #ruby
mramaizng has quit [Quit: mramaizng]
seitensei has quit [Remote host closed the connection]
Taichou has quit [Remote host closed the connection]
lledet has quit [Quit: lledet]
Taichou has joined #ruby
kylesnav has joined #ruby
<kylesnav>
Anyone have a suggestion for a project a new ruby-er can do before they jump into rails?
jhunter has quit [Ping timeout: 246 seconds]
jhunter has joined #ruby
<CloCkWeRX>
kylesnav: there's occasionally things on job worker sites, which will not pay very well but can force you to learn a specific feature of a language.
cirwin has quit [Ping timeout: 244 seconds]
mohits has quit [Ping timeout: 248 seconds]
Taichou has quit [Ping timeout: 246 seconds]
Jackneill has joined #ruby
erichmenge has quit [Quit: Be back later]
Jackneill is now known as Guest89851
erichmenge has joined #ruby
<deryl>
can anyone tell me the difference between a 'Tuple' and an 'Array'? Or what makes a tuple a tuple? Following a course that is using tuples, and python for the language. Was trying to map what he;s doing in the video to Ruby, but I don;t really understand the difference between a Tuple and an Array
<deryl>
so I don;t know what to use in Ruby
erichmenge has quit [Client Quit]
<kylesnav>
a tuple is immutable
<deryl>
the Professor defines a Tuple as: An ordered seqence of elements (implies array), but he added that its immutable
tent4051 has joined #ruby
tent4051 has left #ruby [#ruby]
<deryl>
kylesnav: so basically a frozen array?
<deryl>
foo = [1,2,3,4,5] ; foo.freeze
inteq has joined #ruby
<kylesnav>
deryl: not sure about that but basically you can't (1,3,4).append or .pop (in python)
ngoldman has joined #ruby
<kylesnav>
it's good for a set number of values, that will not need to be changed
<deryl>
ok. the .freeze makes foo uneditable. wondering if its just doing the 'freeze' automatically on creation of the elements in the list, whereas with Array you ahve to call freeze on it, meaning ruby doesn;t have a 'tuple' type
<deryl>
or syntax structure
okiraku_neko has joined #ruby
<deryl>
was just trying to better understand what he was saying. thanks for the comments
<kylesnav>
davidcelis: oh no i see that, I was talking to fowl who solo coded w98 in ruby O.o
<davidcelis>
ah, gotcha
iori has quit [Remote host closed the connection]
jeff_sebring has joined #ruby
<fowl>
it's pretty good for one guy doing all the work dont you think?
<davidcelis>
better than windows ME
<kylesnav>
^
pseudonymous has joined #ruby
<davidcelis>
its like windows ME was written in python or something
<kylesnav>
3.11 > everything
<davidcelis>
lolol
Progster has joined #ruby
iamjarvo has joined #ruby
<pseudonymous>
inside irb - some tips for getting the documentation of a method ? I'm trying to find a method 'detect' which is called on an array of literals matching class names and I'm trying to figure out what it does
<pseudonymous>
(And btw, the python bashing is totally unwarranted - python is great :) Haters)
<kylesnav>
rails > python > ruby
<kylesnav>
there for i will use ruby
<pseudonymous>
That, I agree with. I would've used python had Django not been less supported, less documented, less everything
phanousit has joined #ruby
<pseudonymous>
(but ruby is neat too!)
<kylesnav>
mainly less everything
<mockra>
when I first started getting into programming, I was going to learn Python, but the 2/3 debate steered me to ruby
<pseudonymous>
anyway, the 'help(obj)' inside pythons IDLE and BOOM you have documentation and a list of methods.. Is sorely missed, IRB offers nothing similar I take it ?
redgetan has quit [Quit: This computer has gone to sleep]
<pseudonymous>
cirwin: that sounds rather cool, I'll try that :)
<cirwin>
let me know how you get on :)
<pseudonymous>
kylesnav: the reason why it's gotta be like IDLE is that 1) it's faster and 2) I don't need to know where a method is defined to look it up
<cirwin>
I really missed help() coming to ruby too — but not as much as I missed functions being objects that you could actually call help on
mwilson_ has quit [Excess Flood]
<davidcelis>
function?
<davidcelis>
#wat
<cirwin>
:)
mwilson_ has joined #ruby
jorge has quit [Remote host closed the connection]
<pseudonymous>
here we go :P Ok david, please explain, mathematically the difference between functions and methods :D
lledet has joined #ruby
<davidcelis>
lol
prometheus has joined #ruby
<pseudonymous>
*about pry* uuuuuh, purdy colours!
<davidcelis>
methods are called on objects and more bound to them, functions are just some unit of work
<davidcelis>
functional programming bro
<pseudonymous>
That's the layman's explanation, there's actually more to it, rooted in mathematics, never cared to look for it though
jasonLaster has quit [Remote host closed the connection]
<cirwin>
pseudonymous: :)
<cirwin>
I think you'll find that methods don't exist in mathematics
<cirwin>
(in the function sense)
jasonLaster has joined #ruby
<cirwin>
they mean something totally different by method
jasonLaster has quit [Read error: Connection reset by peer]
yakko has quit [Quit: No Ping reply in 180 seconds.]
yakko has joined #ruby
TPFC-SYSTEM has joined #ruby
rakunHo has joined #ruby
savage- has joined #ruby
uris has quit [Quit: leaving]
<pseudonymous>
cirwin: if I could knight you or something, I would - pry is 10 tonnes of awesome . Now to see if 'rails console' can make use of it
<rking>
Hrm. So you can do like arr.map &:to_s, but how could you say something like: arr.map &:pp
<cirwin>
pseudonymous: check out pry-rails ;)
<davidcelis>
pseudonymous: pry-rails
<davidcelis>
cirwin: grrrrr
<davidcelis>
:)
<rking>
(Meaning call the current self.pp with the element as an arg, instead of the element as the receiver)
<cirwin>
davidcelis: you can win next time
<cirwin>
rking: no — I really really want that
<cirwin>
well, yes
<cirwin>
but it's ugly
<cirwin>
arr.map &method(:pp)
<rking>
I think all pry-rails does is start 'rails console' under Pry instead of IRB? Let me show you the one true .irbrc
jonathanwallace has quit [Ping timeout: 245 seconds]
freeayu__ has joined #ruby
s1n4 has quit [Ping timeout: 255 seconds]
forestbird has left #ruby [#ruby]
kylesnav has quit [Ping timeout: 240 seconds]
abstrusenick has joined #ruby
an2nb2 has quit [Read error: Operation timed out]
Wizek has joined #ruby
an2nb2 has joined #ruby
kylesnav has joined #ruby
Eldariof-ru has joined #ruby
kylesnav has quit [Client Quit]
freeayu__ has quit [Ping timeout: 244 seconds]
vaks has joined #ruby
bairui has quit [Ping timeout: 246 seconds]
s1n4 has joined #ruby
emmanuelux has joined #ruby
mrdodo has joined #ruby
freeayu__ has joined #ruby
qwerxy has quit [Quit: offski]
dhruvasagar has quit [Ping timeout: 246 seconds]
dhruvasagar has joined #ruby
bairui has joined #ruby
ngoldman has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
Rochefort has joined #ruby
mneorr has joined #ruby
qualiabyte has quit [Quit: Leaving]
abstrusenick has quit [Quit: abstrusenick]
Rochefor_ has quit [Ping timeout: 245 seconds]
w0lverine has quit [Quit: w0lverine]
w0lverine has joined #ruby
manizzle has joined #ruby
s1n4 has quit [Ping timeout: 246 seconds]
ukd1_ has joined #ruby
altivec has joined #ruby
terminfo has quit [Ping timeout: 276 seconds]
ukd1 has quit [Ping timeout: 246 seconds]
xorigin has joined #ruby
yugui_zzz is now known as yugui
robotmay has joined #ruby
b1rkh0ff has joined #ruby
cezar has joined #ruby
cezar has quit [Client Quit]
ph^ has joined #ruby
mxweas has quit [Ping timeout: 245 seconds]
Rochefortes has joined #ruby
mahmoudimus has quit [Remote host closed the connection]
ph^ has quit [Remote host closed the connection]
vaks has quit [Ping timeout: 260 seconds]
Quadlex is now known as AwayLex
rakunHo has quit [Remote host closed the connection]
Rochefort has quit [Read error: Connection reset by peer]
und3f has joined #ruby
dhruvasagar has quit [Ping timeout: 240 seconds]
mxweas has joined #ruby
jasonLaster has joined #ruby
dhruvasagar has joined #ruby
cantonic_ has joined #ruby
jasonLaster has quit [Ping timeout: 245 seconds]
cantonic has quit [Ping timeout: 240 seconds]
cantonic_ is now known as cantonic
Fretta has joined #ruby
jonathanwallace has joined #ruby
bullicon has joined #ruby
rutkla has quit [Read error: Connection reset by peer]
mxweas has quit [Ping timeout: 248 seconds]
andrewh has joined #ruby
rutkla has joined #ruby
jonathanwallace has quit [Ping timeout: 246 seconds]
ctp has joined #ruby
EnderMB has joined #ruby
iori has quit [Remote host closed the connection]
mxweas has joined #ruby
Fretta has quit [Quit: Fretta]
mwilson_ has quit [Excess Flood]
mwilson_ has joined #ruby
workmad3 has joined #ruby
mxweas has quit [Ping timeout: 246 seconds]
pskosinski has joined #ruby
dhruvasagar has quit [Ping timeout: 246 seconds]
dhruvasagar has joined #ruby
ngoldman has quit [Remote host closed the connection]
sepp2k has joined #ruby
elhu has quit [Ping timeout: 244 seconds]
mucker has joined #ruby
mwilson_ has quit [Excess Flood]
jorge has joined #ruby
ubuntu has joined #ruby
mwilson_ has joined #ruby
ubuntu is now known as Guest6062
Criztian has joined #ruby
elhu has joined #ruby
jorge has quit [Ping timeout: 248 seconds]
elhu has quit [Client Quit]
mramaizng has quit [Quit: mramaizng]
a_a_g has quit [Quit: Leaving.]
cirwin has quit [Ping timeout: 246 seconds]
Guest6062 has quit [Ping timeout: 245 seconds]
qwerxy has joined #ruby
mfcabrera has quit [Ping timeout: 245 seconds]
mucker has quit [Quit: leaving]
mucker has joined #ruby
mxweas has joined #ruby
dhruvasagar has quit [Ping timeout: 240 seconds]
berserkr has joined #ruby
ph^ has joined #ruby
sepp2k has quit [Ping timeout: 248 seconds]
flype has joined #ruby
ph^ has quit [Remote host closed the connection]
sepp2k has joined #ruby
ukd1_ has quit [Ping timeout: 246 seconds]
kpshek has joined #ruby
lunitikcalm has joined #ruby
lunitikcalm has quit [Remote host closed the connection]
jjang has quit [Remote host closed the connection]
s1n4 has joined #ruby
q0tw4 has joined #ruby
_bart has joined #ruby
nari has quit [Ping timeout: 245 seconds]
mrdodo has quit [Remote host closed the connection]
q0tw4 has quit [Ping timeout: 248 seconds]
EnderMB has left #ruby [#ruby]
jasonLaster has joined #ruby
ubuntu_ has joined #ruby
sinned has joined #ruby
kpshek has quit [Ping timeout: 245 seconds]
NimeshNeema has joined #ruby
johnb003 has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
banisterfiend` has joined #ruby
jasonLaster has quit [Ping timeout: 245 seconds]
imami|afk is now known as banseljaj
banisterfiend` has quit [Read error: Connection reset by peer]
banisterfiend has joined #ruby
q0tw4 has joined #ruby
jonathanwallace has joined #ruby
jonathanwallace has quit [Ping timeout: 248 seconds]
a_a_g has joined #ruby
elhu has joined #ruby
jimeh has quit [Ping timeout: 246 seconds]
lkba has quit [Quit: Bye]
emmanuelux has quit [Ping timeout: 246 seconds]
berserkr has quit [Quit: Leaving.]
asuka_ has quit [Ping timeout: 246 seconds]
emmanuelux has joined #ruby
jimeh has joined #ruby
vaks3 has joined #ruby
w0lverine has quit [Quit: w0lverine]
caveat- has joined #ruby
ubuntu_ has quit [Ping timeout: 248 seconds]
Rochefortes has quit [Remote host closed the connection]
banisterfiend has quit [Read error: Connection reset by peer]
banisterfiend has joined #ruby
ubuntu_ has joined #ruby
binaryplease has joined #ruby
ABK has quit [Ping timeout: 248 seconds]
HRabbit has joined #ruby
ph^ has joined #ruby
jjang has joined #ruby
iband has joined #ruby
iband has quit [Client Quit]
ping-pong has quit [Ping timeout: 246 seconds]
sevvie has joined #ruby
Michael has joined #ruby
Michael is now known as meskyanichi
Codif has joined #ruby
Codif has left #ruby [#ruby]
Taichou has joined #ruby
uris has joined #ruby
<chylli>
hi. I'm studying rails. a question, how does ActiveRecord knows the structure of the table ? will it query db before build the class ?
mohits has quit [Read error: Connection reset by peer]
Taichou has quit [Ping timeout: 244 seconds]
emiltin has joined #ruby
Stalkr_ has joined #ruby
bj0ern has joined #ruby
bj0ern has quit [Client Quit]
apacala_ has quit [Ping timeout: 244 seconds]
<emiltin>
hi, on mac 10.8 i have installed ruby 1.9.3 with rbenv, and set is as global. ruby -v correctly reports 1.9.3. but running 'gem env' shows RUBY VERSION: 1.8.7. shouldn't gem use 1.9.3 too?
ping-pong has joined #ruby
ph^ has quit [Remote host closed the connection]
pskosinski has quit [Quit: I've got a feeling there's a fish in the floor; I'd better squish it or he'll swim out the door; Sometimes they take me for a walk in the sun; I see my fish and I have to run]
yugui is now known as yugui_zzz
pskosinski has joined #ruby
mneorr1 has joined #ruby
x0F has quit [Disconnected by services]
x0F_ has joined #ruby
x0F_ is now known as x0F
mneorr has quit [Ping timeout: 246 seconds]
ZachBeta has joined #ruby
<fowl>
emiltin: do rbenv rehash and `which gem` to make sure its coming from ~/.rbenv/shims
<fowl>
also you need to add some stuff to ~/.bashrc, did you do that?
mfcabrera has joined #ruby
davidpk has joined #ruby
nemesit has joined #ruby
asuka has joined #ruby
eataix has quit [Ping timeout: 260 seconds]
iori has joined #ruby
Foxandxss has joined #ruby
emiltin has quit [Quit: emiltin]
caveat- has quit [Quit: leaving]
caveat- has joined #ruby
patricksroberts has joined #ruby
_bart has quit [Quit: _bart]
jasonLaster has joined #ruby
Spooner has joined #ruby
dhruvasagar has joined #ruby
virunga has joined #ruby
jasonLaster has quit [Ping timeout: 245 seconds]
Vert has joined #ruby
poppiez has joined #ruby
berserkr has joined #ruby
Progster has joined #ruby
burgestrand has joined #ruby
<shevy>
chylli easier to ask on #rubyonrails. I think activerecord follows a convention, both for the name and the structure
tayy has joined #ruby
jonathanwallace has joined #ruby
<matti>
Hi shevy
<shevy>
hey matti
<shevy>
matti sounds finnish
bwlang has quit [Quit: Terminated with extreme prejudice - dircproxy 1.0.5]
jonathanwallace has quit [Ping timeout: 246 seconds]
Rochefort has joined #ruby
jgrevich has quit [Quit: jgrevich]
arkiver has quit [Quit: Leaving]
emmanuelux has quit [Read error: Connection reset by peer]
vlad_starkov has joined #ruby
nemesit has quit [Quit: Leaving...]
<matti>
shevy: It is a Finnish name, indeed.
<matti>
shevy: But in my case it does not reflect my real name.
<chylli>
shevy: thanks very much. I don't know there is a #rubyonrails before.
clocKwize has quit [Quit: clocKwize]
<shevy>
chylli the guys there know a lot more about the whole rails ecosystem than 50% of the guys here :) I for example know only a tiny bit about rails
<shevy>
all I know is that it follows the MVC pattern
<shevy>
and that it uses ugly templates
<shevy>
.erb ewwww
tayy has quit [Remote host closed the connection]
Guedes_out is now known as Guedes
Guedes has quit [Quit: Saindo]
banseljaj is now known as imami|afk
Guedes has joined #ruby
Guedes has quit [Changing host]
Guedes has joined #ruby
<chiel>
shevy: what do you use for templates?
<chiel>
aren't erb supposed to be the most performant?
<shevy>
I hate templates
<chiel>
xD
<chiel>
fair enough
<shevy>
I try to avoid them all by generating whatever I need on the go
<shevy>
I still use ruby .cgi :D the html string is generated
jjang has quit [Remote host closed the connection]
<shevy>
(I dont use the ruby .cgi module though, I hate that one too)
<ddv>
slim or haml ftw
<Muz>
I've just lost a large amount of respect for you, shevy. :(
akem has quit [Ping timeout: 255 seconds]
<shevy>
Muz I still see you use '.' so my respect for you is still there!
<Muz>
D:
ubuntu_ has quit [Ping timeout: 245 seconds]
<shevy>
I need to feel beauty, before I can use something
tvw has joined #ruby
<shevy>
my php days are over
alek_b_ has joined #ruby
jimeh2 has joined #ruby
davidpk_ has joined #ruby
bullicon has quit [Ping timeout: 244 seconds]
beneggett has quit [Ping timeout: 240 seconds]
Paradox has quit [Ping timeout: 240 seconds]
qwerxy has quit [Ping timeout: 244 seconds]
TomRone has quit [Ping timeout: 244 seconds]
JoeTheGuest has quit [Ping timeout: 244 seconds]
IrishGringo has quit [Ping timeout: 240 seconds]
Axsuul has quit [Ping timeout: 240 seconds]
thorncp has quit [Ping timeout: 240 seconds]
verto|off has quit [Ping timeout: 240 seconds]
twinturbo has quit [Ping timeout: 244 seconds]
tomb_ has quit [Ping timeout: 244 seconds]
yugui_zzz has quit [Ping timeout: 244 seconds]
tectonic has quit [Ping timeout: 244 seconds]
sirecote has quit [Ping timeout: 244 seconds]
EricKamsky has quit [Ping timeout: 244 seconds]
rcs has quit [Ping timeout: 244 seconds]
jhunter has quit [Ping timeout: 240 seconds]
banghouse has quit [Ping timeout: 240 seconds]
g4 has quit [Ping timeout: 240 seconds]
yellow5 has quit [Ping timeout: 240 seconds]
{^_^}_ has quit [Ping timeout: 240 seconds]
davidpk has quit [Ping timeout: 244 seconds]
chichou has quit [Ping timeout: 244 seconds]
sgronblom has quit [Ping timeout: 244 seconds]
RichieEvan has quit [Ping timeout: 244 seconds]
SegFaultAX|work2 has quit [Ping timeout: 244 seconds]
<phanousit>
Muz: hey thanks, but doesn't that variable get erased if user puts in two inputs?
Squarepy has quit [Changing host]
Squarepy has joined #ruby
<Muz>
phanousit: what exactly are you trying to do? Do you have any existing code you can post up on gist.github or pastie?
ph^ has joined #ruby
<phanousit>
Muz: I'm trying to write it now, I just thought of it a moment ago. I'm sure its possible
nemesit has joined #ruby
<Muz>
phanousit: what's the input method? A web form? The command line? Some GUI? You're not making it easy to help you.
gmci has quit [Quit: Computer has gone to sleep.]
<phanousit>
Muz: sorry about that. just a simple rb file run on a command line. i want to write a simple program that would give me the final price for an item that has a discount
<lupine_85>
console input is *surprisingly* hard work
Schmidt has joined #ruby
chichou has quit [Ping timeout: 245 seconds]
BrokenCog has quit [Changing host]
BrokenCog has joined #ruby
dhruvasagar has joined #ruby
jonathanwallace has joined #ruby
<phanousit>
Muz: thanks a lot
<Spooner>
I doubt, however, that phanousit wants to use a gem for it though (and saying @highline isn't telling anyone who doesn't already know about it to use the highline gem :D).
jrist-afk is now known as jrist
leoncame` has quit [Read error: Connection reset by peer]
<Muz>
phanousit: worth noting that user input grabbed that way will have a trailing newline character on it, hence the .chop invocations. But that's simple and answers what you asked at the very least.
<lupine_85>
to be honest, I have trouble recommending highline anyway. console input is hard work, and highline doesn't get all of it right
`brendan has joined #ruby
IrishGringo_ has quit [Remote host closed the connection]
<phanousit>
Muz: thanks, its good to know i was on the right track with what i was writing also
maesbn has quit [Read error: Operation timed out]
<Muz>
lupine_85: highline may be a bit of a large overhead for a simple throw-away script too.
ezra has quit [Remote host closed the connection]
sparklr has joined #ruby
<Muz>
Well, relatively large.
resure has quit [Remote host closed the connection]
<Muz>
We're not here to do your actual legwork, but we'll give you a push in the right direction. :)
embraceyourlove has joined #ruby
<sparklr>
Muz: true :) . I just started ruby a week back, have no idea on how to setup
<Muz>
Well, have you installed the gem?
jasonLaster has joined #ruby
maesbn has joined #ruby
<embraceyourlove>
hey guys, plz can you help me? i am under debian, and i need to install gem called redsync, i install it and can see it in gem list, but cant run it via redsync -v or -help.
<embraceyourlove>
Bash says that the command wasnt found
ZachBeta has quit [Quit: Computer has gone to sleep.]
<sparklr>
Muz: i installed it but my ruby got corrupted, reinstalling it
<sparklr>
Muz: true but i need to setup the environment first to get it working
maesbn has quit [Read error: Connection reset by peer]
maesbn has joined #ruby
<jrajav>
Isn't a throwaway script precisely where you *wouldn't* care about overhead? Especially if it reduces your development time?
<embraceyourlove>
plz can you help me? i am under debian, and i need to install gem called redsync, i install it and can see it in gem list, but cant run it via redsync -v or -help.
jasonLaster has quit [Ping timeout: 245 seconds]
tobym_ has joined #ruby
<lupine_85>
as long as you can apt-get install it (and you can), the overhead that matters (setup time) is nil
<shevy>
embraceyourlove, debian is a shit distribution
<jrajav>
That has little to do with his question
<shevy>
it has a lot
<shevy>
they change the default gem path
<jrajav>
.. Oh
<jrajav>
Then I agree
<jrajav>
:P
<shevy>
well it depends what kind of ruby he actually uses
Boffers has joined #ruby
<lupine_85>
pish. it's all changing for unstable, AIUI
<shevy>
debian-ruby or something else
TPFC-SYSTEM has quit [Quit: TPFC-SYSTEM]
<shevy>
embraceyourlove first do "gem env"
<shevy>
and put that result on pastie.org - also do "gem list"
<shevy>
an ideally include that output into your pastie too embraceyourlove
<lupine_85>
for development, I'd suggest using rvm or rbenv to set up your environment. for production, I'd suggest not using gems :)
<shevy>
yeah
<lupine_85>
in this case, assuming you don't want to use rvm/rbenv, the answer is "add wherever debian put the executable, to your $PATH"
<shevy>
both rvm and rbenv are better than having to cater to the modifications in debian-ruby
charliesome has joined #ruby
Bofu has quit [Ping timeout: 255 seconds]
* lupine_85
spends all day every day developing ruby in debian. rvm is invaluable :)
uris has quit [Quit: leaving]
Rajesh has joined #ruby
Rajesh has quit [Max SendQ exceeded]
nanderoo has joined #ruby
Rajesh has joined #ruby
<shevy>
why not the debian ruby? ;)
Rajesh is now known as Guest54087
<lupine_85>
shevy, debian policy and gems do not work well together
<shevy>
hehe
mucker has quit [Quit: leaving]
<lupine_85>
it's not particularly unique to ruby - you see similar issues with cpan, python eggs, etc
ABK has joined #ruby
Berglund has quit [Quit: Computer died.]
iamjarvo has joined #ruby
<Muz>
Don't be silly lupine_85.
rachet has quit [Ping timeout: 264 seconds]
<Muz>
Python doesn't have proper package management yet.
mucker has joined #ruby
<lupine_85>
sure thing, poppet
Guest54087 has quit [Max SendQ exceeded]
<phanousit>
how to i get (45 * .50) to multiply?
<arietis>
how can i remove gem?
Guest54087 has joined #ruby
<arietis>
i got broken version and wanna uninstall package
<Muz>
phanousit: if you're getting that ".50" from somewhere else, you could do (45 * ".50".to_f)
jgarvey has joined #ruby
<phanousit>
thanks Muz thats what i needed
<sparklr>
Muz: i have installed RVM, but when i do "rails new app" it says rails is currently not installed in ubuntu 12.04
<Muz>
#rubyonrails is a channel more suited for Rails questions.
* Muz
never touches rails if he can help it.
<Hanmac>
there will be a rails3.2 package in 12.10
<lupine_85>
rvm use <ruby-version-you-want> (maybe rvm install <ruby-version-you-want> first), then gem install rails, will be required , if you're using rvm from fresh
<jrajav>
Hanmac: Do you know of any builtin refs to STDIN other than that and $stdin?
mengu has joined #ruby
<jrajav>
Hanmac: I'm thinking of just clearing those at the start of every scriptlet rather than disallowing Object#class
<jrajav>
Someone might actually have a use for that, after all
<rking>
jrajav: Why don't you just use LHC then not worry at all about any crippling?
w400z has joined #ruby
<jrajav>
What's LHC
<rking>
Haha
<rking>
I'm not sure.
<rking>
LXC is what I meant.
Eldariof-ru has quit []
<jrajav>
Because I'm a lazyass and didn't want to mess with that or selinux or anything
<jrajav>
I just loaded Arch on a vm with minimal resources
jonathanwallace has quit [Remote host closed the connection]
<rking>
I assure you this is entirely the non-lazy route
rachet has joined #ruby
<jrajav>
If it's trashed it's trashed. I have to spend another 20 minutes reinstalling it
jonathanwallace has joined #ruby
<rking>
You could spend one 20 minutes getting LXC going. =)
strife25 has quit [Quit: Computer has gone to sleep.]
<jrajav>
You still can't ditch the sandbox entirely
sparklr has left #ruby [#ruby]
runeb has joined #ruby
<rking>
jrajav: Why not?
<jrajav>
Allow access to Kernel and IO and I guarantee you someone will find a way to bring down the bot even in an extremely tight chroot
gmci has joined #ruby
runeb has left #ruby ["Leaving..."]
kawa_xxx has joined #ruby
iamlacroix has quit [Remote host closed the connection]
<rking>
If you did, the LXC community would hoist you on their shoulders and parade you around the room for 2 days.
aganov has quit [Quit: aganov]
<phanousit>
Hey Muz: can you take a look at this and tell me what you think? http://pastie.org/4383658
<Muz>
Looks like Ruby to me.
<iamjarvo>
can i modify the object that is returned froma detect?
<rking>
Manually crippling Ruby piece-at-a-time is the way that is: 1) a ton of work, 2) extremely likely to have holes, 3) very likely to be frustrating for users trying to use it in legitimate ways.
niklasb has joined #ruby
<Spooner>
phanousit : Never, ever, ever, use floats with money.
Eldariof-ru has joined #ruby
horrror has joined #ruby
<phanousit>
whats the better option?
kawa_xxx has quit [Remote host closed the connection]
<rking>
Especially since you can skip the parts about bridging the network and about providing much in /dev
<Spooner>
Well, in your case, it really doesn't matter, but it is a general rule :)
<rking>
Spooner: Kind of like Superman 3.
jonathanwallace has quit [Ping timeout: 248 seconds]
tommyvyo has joined #ruby
<horrror>
is there a script/lib to remove preposition and posposition words within a string? Input["Good luck in the finals!"] => Output['good'], ['luck'], ['finals']
<jrajav>
rking: Okay; assume I get that installed and working. How do I run the bot script inside the chroot without arbitrary Ruby code being able to delete the bot's code, fill up the filesystem, etc.?
<al2o3cr>
Hanmac: [28650]
<phanousit>
Spooner: so whats the alternative?
subbyyy has joined #ruby
subbyyy has quit [Client Quit]
jxf has joined #ruby
<jrajav>
Hanmac: What do you think about rking's suggestion of completely ignoring sandboxing and just running the bot in lxc?
<shevy>
hehe
<Spooner>
phanousit : (I read your name as phanosuit and I wonder how to make one) I was being a bit over-zealous. You shouldn't use floats with money, since you can get rounding errors. However, that only really matters in banking situations, not in yours. You might want to use #{"%.2f" % final_price} though, so you don't charge people fractions of cents :)
Berglund has joined #ruby
<bnagy>
anyone know how to multithread a capybara webkit thing? Code works fine in single thread :/
<Spooner>
>> price = 4.234512; "%.2f" % price
<al2o3cr>
Spooner: [4.234512, "4.23"]
embraceyourlove has quit []
phanousit is now known as siamese
<bnagy>
otherwise I guess I'll have to use MRI and fork () :(
<siamese>
thanks Spooner
vvgomes has quit [Ping timeout: 255 seconds]
<Spooner>
>> 12; 24; 55
w400z has quit [Quit: Computer has gone to sleep.]
<al2o3cr>
Spooner: [12, 24, 55]
<jrajav>
Also, does anyone actually like the current bot behavior of outputting every single expression result in an array?
<Spooner>
Hmm, I don't see any reason why the bot should return the result of every statement as an array, rather than just the last (as irb/pry do).
<jrajav>
Otherwise I'm about to change is
<jrajav>
I have literally the best timing in the world ever
<Spooner>
If I want an array, I'll do [12, 23, 55]
<jrajav>
haha
<virunga>
jrajav: it'd be cool have the resulting value of the execution
<jrajav>
virunga: What do you mean? It already gives that
<jrajav>
You mean that you like the current behavior?
<shevy>
ah you mean in the method def short(shortcut) ?
<virunga>
jrajav: i said a stupid thing
<peterhellberg>
shevy: Yeah
<jrajav>
rking: Well sure you can keep it from messing up the overall system; I didn't doubt that. But if they fill up the space that the bot is limited to, the bot can't create any more scriptlets to run
<Spooner>
jrajav I can't see a real need for getting all results. It is clearer to ask for s = "frog"; [s.length, s.chars.length]
<jrajav>
rking: All in all, I think there would be just as many holes to fill, and just as much setup, this way. And I'm almost done configuring it the sandbox way
<rking>
jrajav: That's no big deal. I type >> ,,new-container and it restarts
<lupine_85>
slightly worse performance than mine, slightly shorter ^^
<shevy>
peterhellberg hmm yeah your solution looks much shorter
<peterhellberg>
shevy: I’d probably create a lookup table of some sort on the first run though
bothra has joined #ruby
jonathanwallace has joined #ruby
<jrajav>
virunga: Each >> is a different instance of Ruby entirely
<iamjarvo>
can someone explain a lookup chain to me
<jrajav>
virunga: And yes, if I'm looking then I can see everything you're doing :3
<rking>
jrajav: Another thing about the LXC way is that you can give it a readonly dir packed full of gems.
<virunga>
jrajav: that was my question
<virunga>
:O
Berglund has joined #ruby
<Hanmac>
"Each >> is a different instance of Ruby entirely" unless Hanmac broke it :P
rodj has joined #ruby
<jrajav>
rking: The gems/node modules are already inaccessible even if you broke the sandbox. I installed them as root
<rking>
jrajav: Meh. It's up to you, of course. I think you should at least get the lxc tools and play around with them for a few minutes so you know exactly how easy (and how airtight) all of this is. Otherwise, I can all but guarantee the current bot is not truly locked down.
vaks3 has joined #ruby
<jrajav>
You're more than welcome to try breaking it
<rking>
jrajav: Yeah, the Unix user-level stuff is going to get you a certain degree of security, sure.
<jrajav>
Aside from the STDIN hole that I'm literally just about to patch we think it's pretty airtight now
<Spooner>
jrajav : You should backup the VM drive file, so that if it breaks, it is just a 4s fix (rather than recreate VM) :)
<jrajav>
Good call
jstew has joined #ruby
<jrajav>
Hopefully unix permissions mean that the worst someone can do is delete the script and my .bash_profile :P
<jrajav>
And I'll probably github the script soon
sailias has quit [Quit: Leaving.]
strife25 has joined #ruby
jxf has quit [Read error: Connection reset by peer]
<jrajav>
Bot going down for changes and testing
<jrajav>
Hanmac, naughty
jimeh3 has quit [Ping timeout: 248 seconds]
al2o3cr has quit [Remote host closed the connection]
linoj has joined #ruby
<rking>
In any security setup you are pushing the "inconvenience of vulnerability" as far forward while simultaneously pulling the "inconvenience of legitimate use" as far backward as you can. This solution seems to not go very far with either of those aspects.
<Hanmac>
jrajav: what do you mean? :P
<jrajav>
Hanmac: You've ignored my questions :<
<rking>
[* BTW: If any of you security geeks has advice on what I should read to learn the actual terms and theory for stuff like what I'm talking about with my last comment, I'd like to get further into it than randomly pondering. Thanks!]
zeromodulus has quit [Remote host closed the connection]
<jrajav>
rking: I see where you're coming from, but I don't see a use case for Kernel and IO access in a single-line scriptlet IRC bot
arkiver has quit [Quit: Leaving]
<rking>
Also I think there should be long-running sessions. It'd be more fun if someone could come in here and define some stuff then the others could tweak it. You could provide a special command, like >!>! or something, to restart.
<jrajav>
Hanmac: Now that you've tested it before I even brought it back in chan, can you look at my earlier question about STDIN? :P
<Hanmac>
jrajav: the last i try before reboot was: >> STDIN.send("cla"+"ss").readlines("/home/jrajav/.bash_profile","r")
<Hanmac>
:P
<rking>
jrajav: Then we can't tell n00bs how to use those things. It's simple.
<jrajav>
I saw that
devdazed has quit [Quit: Bye]
<rking>
Or non-noobs for that matter.
<jrajav>
rking: How would you demonstrate it to them anyway? The return value isn't going to be useful
<rking>
Also, the bot in #perl has done this for years (and using "chroot", which isn't as good or easy as LXC)
<jrajav>
rking: Again, I see where you're coming from. This is only half laziness on my part… not that laziness is a vice in all cases. It's mainly that I'm still not convinced of any kind of use case for Kernel + IO access
lunitikcalm has joined #ruby
<jrajav>
So I don't see any disadvantage to sandboxing
<jrajav>
Now, what IS a problem is that Sandrbox seems to do some parsing of its own
<jrajav>
Resulting in fun stuff like this
<jrajav>
>> "it's; a; bit; broken"
<al2o3cr>
jrajav: "SyntaxError: sandrbox:4: unterminated string meets end of file"
tobym_ has quit [Remote host closed the connection]
digitalcakestudi has joined #ruby
<rking>
But it doesn't seem to have the long-running session support like I'm thinking would be really fun/useful.
<jrajav>
Huh
<ecksit>
just a quick discussion about the differences between arrays and hashes if anyone has the time. hashes are assigned key => value pairs like :name => username whereas arrays just have a integer for a key?
<virunga>
yep, would be really cool. But one step at time
<jrajav>
rking: This looks great. Does this require an LXC kernel or is this something else entirely?
<virunga>
the bot is brand new
<lupine_85>
ecksit, right
freeayu has joined #ruby
<jrajav>
rking: And yeah I *really* don't see a use case for long-running sessions. If you're doing something that needs more than one line, just move out of the chan
freeayu__ has quit [Read error: Connection reset by peer]
<jrajav>
This isn't meant to be a mini-development-environment
<ecksit>
and that is the major difference? lupine_85?
<jrajav>
Just a neat demonstration tool
<apeiros_>
ecksit: hashes can use almost *any* object as key
<lupine_85>
anything that implements .hash and .eql? sanely
s1n4 has joined #ruby
Guest47075 is now known as verto
<ecksit>
thanks apeiros_. just reading and the examples provided are using them pretty interchangably so i thought i would clarify the difference.
<lupine_85>
there are other differences, such as arrays having different ordering semantics, that kind of thing
davidpk has joined #ruby
<ecksit>
yep, read about those. and stuff like changing the value doesn't alter the position within the array.
hynkle has joined #ruby
s1n4 has quit [Client Quit]
<lupine_85>
(e.g., [0,1,2].each { ... } and {0=>0,1=>1,2=>2}.each {...} may not be the same
<apeiros_>
theoretically, hashes are also unordered. ruby (as of 1.9) retains insertion order
<Tasser>
apeiros_, almost?
levieraf has joined #ruby
<apeiros_>
Tasser: you could undefine hash/eql? or have a broken implementation of them
theRoUS has joined #ruby
<apeiros_>
though it might even be that ruby falls back to using identity for that. never tried.
<rking>
jrajav: NoobF4ce1 joins, and says, ">> input = [1,2,3]; expected = [[1], [2], [3], [1, 2], [1, 3], [2, 3]]; # Any ideas on how I can get this?"
<apeiros_>
hope. just fails.
<lupine_85>
the differences between an array and a dictionary are more important in less flexible languages, really
cpruitt has joined #ruby
<rking>
jrajav: cirwin casually replies, ">> 1.upto(input.size-1).map { |n| input.combination(n).to_a }.flatten(1) == expected # But I bet there's a more elegant way."
<apeiros_>
s/hope/nope/
<apeiros_>
(wtf? odd typo)
yekta has joined #ruby
joast has joined #ruby
<jrajav>
rking: Neat, but you're going to have a very polluted namespace very fast
<rking>
jrajav: So you !>!>
<jrajav>
rking: And what about the first joker who does >> true while true
<rking>
Actually, you .>.> for a new session, !>!> for a new container.
<rking>
jrajav: Easy to manage with lxc
<jrajav>
Not if you want them all running in the same session
<jrajav>
Okay, I'm making another few changes. I actually suspect that this will break the bot, because I'm still not sure how Node.js' child_process.exec() actually deals with stdout and stderr when the process exits with nonzero status
enroxorz has joined #ruby
enroxorz has joined #ruby
enroxorz has quit [Changing host]
al2o3cr has quit [Remote host closed the connection]
IPGlider has joined #ruby
freeayu has joined #ruby
<jrajav>
Also, it will now print the results more nicely
al2o3cr has joined #ruby
<jrajav>
al2o3cr: ping
<al2o3cr>
jrajav: pong
<jrajav>
>> 1 + 3
<al2o3cr>
jrajav: The Ruby interpreter exited with a nonzero status. Hanmac is probably to blame.
<jrajav>
:/
<jrajav>
If it prints them at all
<jrajav>
lol
al2o3cr has quit [Remote host closed the connection]
lledet has joined #ruby
joshman_ has joined #ruby
<Hanmac>
>> 4 + 5
<Hanmac>
:/
vvgomes has joined #ruby
enroxorz is now known as quaid
al2o3cr has joined #ruby
<jrajav>
>> 42
<al2o3cr>
jrajav: (Fixnum) 42
<jrajav>
Yay
<jrajav>
>> [1, 3]
<al2o3cr>
jrajav: (Array) [1, 3]
<jrajav>
Features!
<virunga>
nice
quaid has left #ruby [#ruby]
<jrajav>
Aaaand
<jrajav>
Hm
<jrajav>
Oh right
<jrajav>
>> "break; now"
<al2o3cr>
jrajav: (String) "SyntaxError: sandrbox:2: unterminated string meets end of file"
<jrajav>
Hanmac: I can't remember anything that crashes Ruby :(
<jrajav>
Oh wait dammit I deleted that line lol
<jrajav>
One sec
al2o3cr has quit [Remote host closed the connection]
pu22l3r has joined #ruby
al2o3cr has joined #ruby
<jrajav>
Hanmac: Okay, crash it somehow
bbttxu has quit [Quit: bbttxu]
<Muz>
>> GC::disable; 100000000.times { Kernel.send(:const_set, "A#{rand(9999999)}", "I LOVE PONIES") }; GC::stat
<al2o3cr>
Muz: The Ruby interpreter exited with a nonzero status. Hanmac is probably to blame.
<Muz>
What do I win?! :D
<jrajav>
Did you get the stdout PMed to you?
Berglund has quit [Ping timeout: 245 seconds]
<Muz>
jrajav: nope.
<Hanmac>
Muz you only crash the ruby, not the bot
<jrajav>
:/
<jrajav>
Hanmac: That's what I meant. I'm trying to make it PM stdout + stderr
emsilva has quit [Quit: Computer has gone to sleep.]
rohit has joined #ruby
wallerdev has joined #ruby
Berglund has joined #ruby
shell0x has joined #ruby
<shevy>
hmm
<shevy>
so we cant break out of the bot jail
al2o3cr has quit [Remote host closed the connection]
al2o3cr has joined #ruby
<jrajav>
>> GC::disable; 100000000.times { Kernel.send(:const_set, "A#{rand(9999999)}", "I LOVE PONIES") }; GC::stat
<al2o3cr>
jrajav: The Ruby interpreter exited with status undefined. Hanmac is probably to blame.
al2o3cr has quit [Remote host closed the connection]
<jrajav>
Whooooa
<jrajav>
Welp. It works
<jrajav>
:D
<jrajav>
(I killed it myself to make it stop PMing me stderr XD)
<jrajav>
Muz: Nice one btw
Berglund has quit [Client Quit]
<ecksit>
what is the proper ruby code to this? title2 = title.sub(['dark', 'stormy'], ['clear', 'bright'])
nemesit has joined #ruby
<ecksit>
multiple string replace, i suppose you could call it.
andrewh has quit [Ping timeout: 246 seconds]
<peterhellberg>
ecksit: do you want to replace dark with clear and stormy with bright?
<ecksit>
correct
knirhs has quit [Ping timeout: 255 seconds]
<ecksit>
without spreading it over multiple lines if possible
andrewh has joined #ruby
<ecksit>
i understand it /can/ be broken up, just really rather not.
sailias has joined #ruby
internet_user has joined #ruby
<ecksit>
i could drop it in a block
al2o3cr has joined #ruby
<jrajav>
>> 1 + 2
<al2o3cr>
jrajav: (Fixnum) 3
[Neurotic] has quit [Quit: Leaving]
<jrajav>
>> GC::disable; 100000000.times { Kernel.send(:const_set, "A#{rand(9999999)}", "I LOVE PONIES") }; GC::stat
delinquentme has joined #ruby
<al2o3cr>
jrajav: The Ruby interpreter exited with nonzero status. Hanmac is probably to blame.
minijupe has joined #ruby
<delinquentme>
shouldn't all ruby objects respond to .superclass?
<jrajav>
No?
<jrajav>
>> 3.superclass
<al2o3cr>
jrajav: (NilClass) nil
<jrajav>
:O
<jrajav>
I guess irb just sucks haha
<jrajav>
NEW FLASH
<rking>
Wait, nil?
<jrajav>
*news..
<delinquentme>
I want to check what kind of inheritance an opbject has
<delinquentme>
is base class a better word?
horrror has joined #ruby
<jrajav>
rking: irb gives NoMethodError for the same expression
<lupine_85>
I think it's safe, but it does lead to some delicious backtrace output
digitalcakestudi has quit [Ping timeout: 248 seconds]
baroquebobcat has joined #ruby
<delinquentme>
ok so I've got this ruby <> libgit2 gem called rugged .. and I'm attempting to traverse my commit history ( which I've got access to already )
wmoxam_ has joined #ruby
<delinquentme>
now the commit history is represented as a Enumerable object
<delinquentme>
how do I crack into these?
cjs226 has quit []
mockra has quit [Remote host closed the connection]
<Spooner>
Again, not sure the Class info is necessary, since if I want class, I'd ask for it. s = "s"; [s, s.class]
<Spooner>
rking : It just times out.
baroquebobcat has joined #ruby
<jrajav>
Spooner: It's intended more for beginners
<Hanmac>
>> [1]
<al2o3cr>
Hanmac: (NilClass) nil
<Spooner>
asteve include and require are completely different things; not sure what you mean.
<jrajav>
:/
<jrajav>
What's going on here
<Hanmac>
yeah its very nil :P
<hoelzro>
>> puts 'hi'
<al2o3cr>
hoelzro: (NilClass) nil
<hoelzro>
=(
Abbas| has quit [Ping timeout: 255 seconds]
<asteve>
Spooner: how would I access module B from inside module A?
<Hanmac>
asteve B::A
<Spooner>
jrajav : Yes, but beginners are being told something which is mostly superfluous and non-consistant with ther result they'd get from irb/pry.
vvgomes has joined #ruby
<jrajav>
>> 1
<al2o3cr>
jrajav: (NilClass) nil
<asteve>
Hanmac: I don't think that's right; maybe I'm asking the wrong question
<jrajav>
double-ewe tee eff
<jrajav>
Wasn't this just working?
<Hanmac>
jrajav it may be the problem with "STDOUT" :P
<asteve>
module B, class C; B::C; but I need to access this from module A
<asteve>
different files in the same directory structure
<jrajav>
Hanmac: D'oh!
<hoelzro>
asteve: B::C?
<Spooner>
asteve : You just use B::C
<asteve>
that's too easy
<hoelzro>
the directory structure doesn't matter
<hoelzro>
it's not like Python
<Hanmac>
asteve i can do it more complcated if you want
nari has joined #ruby
<jrajav>
Hanmac: So, uh…. wait. This is an impossible problem to solve then. How do I print out the output while keeping STDOUT inaccessible?
<Spooner>
Doesnt' matter where you are accessing it from. If you have a B in A, then you'd need to do ::B::C (use the global B, not A::B).
<hoelzro>
jrajav: how are you evaluating the code?
<jrajav>
Hanmac: I can't clear STDOUT, because then I can't p or puts. I can't not clear STDOUT because then IO is accessible
<jrajav>
D:
<Tasser>
... whut?
<jrajav>
Wait. I could just disable calling Object#class on STDOUT
<Hanmac>
hoelzro its because when someone (or i) breaks the ruby, the bot should be suvive that
<jrajav>
What's the best way to do that?
<Tasser>
>> eval(96.chr + "ls /" + 96.chr)
<al2o3cr>
Tasser: (NilClass) nil
<hoelzro>
Hanmac: right; I just think a subprocess would be better
<Mon_Ouie>
jrajav: Same way sandrbox make classes and constants inaccessible: it only needs to be inaccessible in the sandbox
<jrajav>
Mon_Ouie: I'm printing out the result in the sandbox, though
<jrajav>
Wait. No I'm not
andrewh has quit [Ping timeout: 246 seconds]
jimeh3 has joined #ruby
<jrajav>
Wait a minute. I'm not doing puts inside the sandbox.
<jrajav>
So why IS it just giving back nil?
cakehero has joined #ruby
<Mon_Ouie>
You can just stdin, stdout, stderr = $stdin, $stdout, $stderr; (remove global_variables and constants); run the sandbox; use the local variables
ukd1 has joined #ruby
<jrajav>
The sandbox is completely separate from the surrounding code afaict
axl_ has joined #ruby
<jrajav>
It gives me back an array with the expression results
andrewh has joined #ruby
<Mon_Ouie>
Well, where's the code?
<jrajav>
This is as good a time as any to throw it on github
philcrissman has joined #ruby
tiripamwe has joined #ruby
<jrajav>
And I might as well bring it down while it's not even working
<jrajav>
:/
al2o3cr has quit [Remote host closed the connection]
jasonLaster has joined #ruby
jasonLaster has quit [Remote host closed the connection]
<s_man>
Hi, I have a simple ruby code and I wold like to run it in an rails app. Do I have to call the ruby.rb file or can I just pass the code to the html file
jonathanwallace has quit [Ping timeout: 248 seconds]
iamjarvo has joined #ruby
<Hanmac>
s_man: goto #rubyonrails
<s_man>
ok thanks
Eldariof-ru has quit [Read error: Operation timed out]
<jrajav>
Also, should be obvious, but it requires the jerk node module and the Sandrbox ruby gem
<jrajav>
If you actually wanted to run it
chimkan has joined #ruby
mneorr1 has quit [Quit: Leaving.]
<jrajav>
So, to recap: Currently the bot returns (NilClass) nil for everything, and I have no clue why. I'm assuming it has something to do with STDOUT being set to nil.
[diecast] has joined #ruby
<shevy>
lol
nari has quit [Ping timeout: 244 seconds]
<shevy>
now you yourself broke it :>
<jrajav>
However, that's kind of necessary to avoid access to the IO class. Alternatively I could block Object#class for just STDOUT. Anyone have an idea how I'd do that?
<jrajav>
Wait why don't I just remove_instance_method
vertroa has quit [Client Quit]
vvgomes has quit [Ping timeout: 246 seconds]
vertroa has joined #ruby
benson has joined #ruby
<Hanmac>
jrajav you can remove #class only for STDOUT ... but it does not prevent me from using it
<jrajav>
It doesn't look like Sandrbox needs stdout to do its magic
<jrajav>
Ahhhhh so confused
Rochefort has quit [Remote host closed the connection]
vvgomes has joined #ruby
<Hanmac>
did you try to use :STDOUT with the bad_constants ?
<jrajav>
Trying that now actually
<jrajav>
Heh, wow
<jrajav>
<@jrajav> >> 1 + 3
<jrajav>
<al2o3cr> jrajav: (String) "TypeError: #<IO:<STDOUT>> is not a symbol"
<jrajav>
Sandrbox DOES use stdout somehow
<jrajav>
But I can't figure out where
<Mon_Ouie>
jrajav: Erm, the Ruby code is very hard to read though
<jrajav>
Mon_Ouie: Yeah sorry
<Mon_Ouie>
Why not already putting it in an external file?
<jrajav>
Because then I can't magically inline message.match_data[1] as easily
<Mon_Ouie>
Surely you can do IO
<jrajav>
meeeeeeh
hoelzro is now known as hoelzro|away
<jrajav>
I gotta go for now. Sorry, the bot will be gone for a while today. :(
xorigin has quit [Quit: leaving]
<jrajav>
PM me if you figure out anything more
sendoushi has quit [Ping timeout: 244 seconds]
Speed has joined #ruby
Speed has quit [Changing host]
Speed has joined #ruby
nemesit has joined #ruby
elhu has joined #ruby
vvgomes has quit [Ping timeout: 246 seconds]
umttumt has joined #ruby
dhruvasagar has quit [Ping timeout: 246 seconds]
berserkr has joined #ruby
rakm has joined #ruby
vvgomes has joined #ruby
bluOxigen has quit [Ping timeout: 248 seconds]
WellMux has joined #ruby
ForSpareParts has quit [Disconnected by services]
ForSpareParts has joined #ruby
DrShoggoth has joined #ruby
aantix has joined #ruby
liluo has joined #ruby
aantix has quit [Read error: Connection reset by peer]
tfitts has quit [Quit: Leaving]
aantix has joined #ruby
aantix has quit [Read error: Connection reset by peer]
resure has quit [Remote host closed the connection]
chimkan has quit [Quit: chimkan]
mfcabrera has quit [Ping timeout: 240 seconds]
locriani has joined #ruby
locriani has quit [Changing host]
locriani has joined #ruby
delinquentme has quit [Ping timeout: 245 seconds]
adeponte has joined #ruby
tfitts has joined #ruby
sevvie has joined #ruby
w0lverine has joined #ruby
aantix has joined #ruby
afwefawefawfewa has joined #ruby
elhu has quit [Quit: Computer has gone to sleep.]
Vert has quit [Ping timeout: 252 seconds]
niklasb has quit [Quit: WeeChat 0.3.8]
elhu has joined #ruby
ianbrandt has joined #ruby
WellMux has quit []
jonathanwallace has joined #ruby
chylli has quit [Remote host closed the connection]
zodiak has quit [Read error: No route to host]
Jake232 has joined #ruby
davidcelis has joined #ruby
afwefawefawfewa has left #ruby ["ERC Version 5.3 (IRC client for Emacs)"]
havenn has joined #ruby
Criztian has quit []
Hawklord has joined #ruby
niklasb has joined #ruby
zodiak has joined #ruby
ken_barber has joined #ruby
<ForSpareParts>
Have you guys made extensive use of any Markdown gems? I'm looking into Kramdown and I can't figure out how it decides whether parsing tasks go to the block-level or span-level handlers.
lunitikcalm has quit [Remote host closed the connection]
i0n has joined #ruby
lunitikcalm has joined #ruby
stkowski has joined #ruby
verto|off is now known as verto
Z_Mass has joined #ruby
verbad has joined #ruby
tvw has quit [Remote host closed the connection]
Wizek has quit [Ping timeout: 246 seconds]
goraxe has quit [Read error: Connection reset by peer]
codespectator has quit [Ping timeout: 248 seconds]
lunitikcalm has quit [Read error: Connection reset by peer]
bradhe has joined #ruby
geekbri has quit [Remote host closed the connection]
Criztian has joined #ruby
jhunter_ has quit [Ping timeout: 255 seconds]
resure has joined #ruby
jhunter has joined #ruby
EricKamsky_ has quit [Ping timeout: 246 seconds]
codespectator has joined #ruby
pdtpatrick has joined #ruby
elhu has quit [Quit: Computer has gone to sleep.]
a_a_g has joined #ruby
cirwin has joined #ruby
<s_man>
can someone tell me please how to run a ruby code in an rails app?
<apeiros_>
s_man: you do realize that your whole rails app *is* ruby code?
methodmat312 has joined #ruby
<methodmat312>
hi, really stupid question, but it's friday
geekbri has joined #ruby
<methodmat312>
i am trying to split a string with unicode char 8722
<sernin>
How to change this: h = {host: %w[a b], search: [1,2]} to a = %w[a1,a2,b1,b2]
<methodmat312>
rails 1.9.3
quest88 has quit [Quit: quest88]
<methodmat312>
oops
<methodmat312>
ruby 1.9.3
<apeiros_>
methodmat312: "\uHHHH"
<apeiros_>
the \u escape also works in a regex literal
Eldariof-ru has joined #ruby
<sernin>
i somehow think there is a method for this but can't remember it. or along the lines of it.
headius has quit [Quit: headius]
chimkan_ has joined #ruby
<apeiros_>
sernin: %w is not , separated
<methodmat312>
thx aperios
<methodmat312>
apeiros
<apeiros_>
and there's no single method to do that
fbernier has quit [Ping timeout: 245 seconds]
<apeiros_>
you'd zip host with search
<apeiros_>
oh, wait, you want more than zip
maletor has joined #ruby
<sernin>
zip, that was what i was thinking of
<apeiros_>
you wan't product
<Tasser>
apeiros_, sometimes people just agree with you ;-)
<apeiros_>
with zip you get a1,b2
<apeiros_>
Tasser: you didn't make it seem like you agreed :-p
voodoofish has quit [Ping timeout: 245 seconds]
<sernin>
product does a cartesian product or what-have you, yes? all possible combinations?
<Muz>
There's a difference in the pronunciation of the 'a'. ¬_¬
hynkle has joined #ruby
<WhereIsMySpoon>
Hanmac: you mean the source code of std::fstream?
codespectator has quit [Quit: Computer has gone to sleep.]
<WhereIsMySpoon>
its in the standard C libs
<virunga>
i've an instinct for this
<virunga>
ahaha
Berglund has joined #ruby
lxsameer has quit [Max SendQ exceeded]
<Mon_Ouie>
Of your code that is using it, most likely
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
<WhereIsMySpoon>
void main()
<WhereIsMySpoon>
{
<WhereIsMySpoon>
std::fstream fs;
<WhereIsMySpoon>
}
mrsolo has joined #ruby
<Mon_Ouie>
Also, it isn't (it's C++) and not all compilers use the same implementation
<WhereIsMySpoon>
that's it
cj3kim has joined #ruby
<WhereIsMySpoon>
i meant c++, sorry
<virunga>
-.-'
<virunga>
that crashes?
<WhereIsMySpoon>
yes
lxsameer has quit [Max SendQ exceeded]
<virunga>
WhereIsMySpoon: why are you asking on #ruby? :D
voodoofish has joined #ruby
rcassidy has joined #ruby
<WhereIsMySpoon>
because #c and #c++ are horrible places
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
<virunga>
i know they
<WhereIsMySpoon>
and #ruby is lovely
<WhereIsMySpoon>
as to why im on #ruby, ive done some ruby before
cezar has quit [Quit: Leaving]
lxsameer has quit [Max SendQ exceeded]
<Muz>
...
<virunga>
WhereIsMySpoon: why do you want to use c++?
<WhereIsMySpoon>
why not?
lxsameer has joined #ruby
<Hanmac>
virunga because i use c++ too to boost my ext-gems
<WhereIsMySpoon>
i wish to learn more about it
<WhereIsMySpoon>
therefore i program in it
<WhereIsMySpoon>
Mon_Ouie: Hanmac: any ideas?
<WhereIsMySpoon>
or is it just an unfixable bug in the source of fstream
lxsameer has quit [Max SendQ exceeded]
<Mon_Ouie>
Runs just fine here, so I'd guess bad compiler options
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
<lectrick>
Why does String#to_i return 0 instead of nil when the string actually doesn't have any numbers?
umttumt_ has joined #ruby
umttumt_ has quit [Remote host closed the connection]
<virunga>
lectrick: ask to Matz
<Hanmac>
lectrick because some methods are nice to the user
<Hanmac>
WhereIsMySpoon: i need your sourcecode first
<WhereIsMySpoon>
Mon_Ouie: hm, i just tried it in a new project and it worked fine there
tiripamwe has quit [Ping timeout: 240 seconds]
jrajav has quit [Quit: The best darkness is strange and surprising]
<WhereIsMySpoon>
le sigh
lxsameer has quit [Max SendQ exceeded]
tommyvyo has joined #ruby
tommyvyo has quit [Client Quit]
lxsameer has joined #ruby
abdulkarim has joined #ruby
<virunga>
WhereIsMySpoon: there's also c++-base for noobs i believe
<virunga>
there they use more kindness
tommyvyo has joined #ruby
<lectrick>
Hanmac: "nice"?
lxsameer has quit [Max SendQ exceeded]
lxsameer has joined #ruby
vvgomes has quit [Ping timeout: 246 seconds]
lxsameer has quit [Max SendQ exceeded]
brianpWins has joined #ruby
<rcassidy>
ada2358: sup
umttumt has quit [Ping timeout: 245 seconds]
br4ndon has quit [Quit: Lorem ipsum dolor sit amet]
lxsameer has joined #ruby
lxsameer has quit [Changing host]
lxsameer has joined #ruby
lxsameer has quit [Read error: Connection reset by peer]
<rcassidy>
>> p "I wonder if the bot is here"
<Mon_Ouie>
Nope
kenichi has joined #ruby
<rcassidy>
aw
<Mon_Ouie>
You know you don't have to send it a message to find out if it's here? ;)
<rcassidy>
yeah i guess but it was more fun that way
tiripamwe has joined #ruby
workmad3 has quit [Ping timeout: 246 seconds]
bier has joined #ruby
<Hanmac>
Mon_Ouie did you notic what i did the last time when the bot was there? i changed the ~/.bash_profile :P
mfcabrera has joined #ruby
Taichou has joined #ruby
jasonLaster has quit [Remote host closed the connection]
apok has quit [Remote host closed the connection]
apok has joined #ruby
jasonLaster has joined #ruby
Z_Mass has quit [Ping timeout: 244 seconds]
kevincolyar has joined #ruby
<kevincolyar>
anyone know a message i can send to an object to get the object right back?
<kevincolyar>
somthing line 3.send(:self)
<kevincolyar>
wont let me :dup or :clone
verbad has quit []
<Hanmac>
oO why do you need it? ... you can store mostly everything in a variable
gmci has quit [Quit: Computer has gone to sleep.]
<Hanmac>
kevincolyar show me where your actual problem is
<kevincolyar>
i'm comparing class attributes and usually i can just send obj.send(attribute), but when i'm comparing things like numbers i just want the value of the object itself, not an attribute on the object
Taichou has quit [Ping timeout: 246 seconds]
cj3kim has quit [Quit: This computer has gone to sleep]
<kevincolyar>
i'd like to say something like obj.send(:value) when i'm dealing with a "value" object
dross_ is now known as dross
jasonLaster has quit [Ping timeout: 248 seconds]
jorge has quit [Remote host closed the connection]
gmci has joined #ruby
bluenemo has quit [Remote host closed the connection]
<kevincolyar>
Hanmac: i've done that, just thought there might be something a little more elegant :)
khakimov has quit [Quit: Computer has gone to sleep.]
noyb has quit [Quit: Leaving.]
stkowski has quit [Quit: stkowski]
stkowski has joined #ruby
andrewh has quit [Ping timeout: 246 seconds]
noyb has joined #ruby
jonathanwallace has quit [Remote host closed the connection]
jonathanwallace has joined #ruby
akem has quit [Read error: Connection reset by peer]
<rontec76>
Hi all, I'm getting the error "private method `load' called for MultiJson:Module" doing this "result = MultiJson.load(response.body, :symbolize_keys => true)" within a custom method.
user__ has joined #ruby
<rontec76>
testing on my data from irb MultiJson.load works fine. Any thoughts on what I'm doing wrong?
adamkittelson has joined #ruby
ForSpareParts has quit [Ping timeout: 246 seconds]
<rontec76>
I am loading up multi_json with require 'multi_json' at the beginning of my file as well so not sure if this is a bug or a scope issue that I"m understanding
ForSpareParts has joined #ruby
jonathanwallace has quit [Ping timeout: 248 seconds]
ianbrandt has quit [Quit: ianbrandt]
linoj has quit [Ping timeout: 244 seconds]
<rodj>
!AlleBucher Gertrude Chandler Warner - [Boxcar Children 001] - The Boxcar Children (retail) (epub).rar
<rodj>
oops sorry, wrong window
<WhereIsMySpoon>
virunga: c++-base doesn't exist
linoj_ has quit [Ping timeout: 244 seconds]
artOfWar has joined #ruby
ianbrandt has joined #ruby
cirwin has joined #ruby
cirwin has quit [Remote host closed the connection]
aantix_ has joined #ruby
scant has joined #ruby
banisterfiend` has joined #ruby
<WhereIsMySpoon>
hey banister :)
jgrevich has joined #ruby
ForSpareParts|lo has joined #ruby
aantix has quit [Ping timeout: 244 seconds]
aantix_ is now known as aantix
mrdodo has joined #ruby
jasonLaster has joined #ruby
<banisterfiend`>
WhereIsMySpoon: if u talk to me ill have u arrested
<WhereIsMySpoon>
nice to see you too
banisterfiend has quit [Ping timeout: 248 seconds]
Goles has joined #ruby
jbw has quit [Ping timeout: 252 seconds]
<davidcelis>
caan you feeeel the loooove toniiiiight
atmosx has joined #ruby
shadoi has joined #ruby
xaq has quit [Read error: Connection reset by peer]
GoGoGarrett has quit [Remote host closed the connection]
xaq has joined #ruby
<rking>
Haha
mahmoudimus has joined #ruby
ringotwo has joined #ruby
bricker88 has joined #ruby
banisterfiend` has quit [Read error: Connection reset by peer]
banisterfiend has joined #ruby
lkba has quit [Ping timeout: 244 seconds]
sevvie has quit [Quit: sevvie]
pskosinski has quit [Ping timeout: 245 seconds]
binaryplease has quit [Quit: WeeChat 0.3.8]
jasonLaster has quit [Ping timeout: 240 seconds]
a_a_g has quit [Quit: Leaving.]
a_a_g has joined #ruby
nyuszika7h has quit [Changing host]
nyuszika7h has joined #ruby
jasonLaster has joined #ruby
AlbireoX_ has joined #ruby
jbw has joined #ruby
jonathanwallace has joined #ruby
yakko has quit [Remote host closed the connection]
MasterIdler_ has joined #ruby
MasterIdler_ has quit [Client Quit]
krusty_ar has quit [Read error: Connection reset by peer]
emsilva has joined #ruby
emsilva has quit [Changing host]
emsilva has joined #ruby
Jake232 has quit [Ping timeout: 245 seconds]
ForSpareParts has quit [Disconnected by services]
ForSpareParts|lo is now known as ForSpareParts
krusty_ar has joined #ruby
jayvan has quit [Ping timeout: 255 seconds]
jayvan has joined #ruby
phinfonet has joined #ruby
MasterIdler_ has joined #ruby
cjs226 has quit []
MasterIdler_ has quit [Client Quit]
mascool has joined #ruby
MasterIdler_ has joined #ruby
MasterIdler has quit [Ping timeout: 248 seconds]
MasterIdler_ is now known as MasterIdler
chichou_ has quit [Remote host closed the connection]
jrajav has joined #ruby
uris has quit [Ping timeout: 240 seconds]
liluo has quit [Remote host closed the connection]
shashin has quit [Quit: shashin]
<jrajav>
Hanmac: You around?
fbernier has joined #ruby
sevvie has joined #ruby
<Hanmac>
yeah, should i break something again?
qwerxy_ has quit [Quit: offski]
kvirani has joined #ruby
<jrajav>
I'm wondering if you have any ideas about keeping STDOUT around, but disallowing getting IO from it
<jrajav>
I tried adding config.bad_methos << [:STDOUT, :class]
<jrajav>
That breaks Sandrbox too
<jrajav>
*bad_methods
<jrajav>
(I have no idea if that's the right way to do it)
<Hanmac>
and bad_constants << :STDOUT dont work too?
<jrajav>
Yeah
<jrajav>
That is; it does what it's supposed to, but then Sandrbox can't do something it needs to to capture the output
<Hanmac>
:P
<jrajav>
I'm assuming it's doing something hacky liking hooking stdout and doing 'p' on each expression
zii has quit [Ping timeout: 252 seconds]
resure has quit [Ping timeout: 240 seconds]
apok_ has joined #ruby
<jrajav>
This is what I get:<al2o3cr> stderr: /home/jrajav/.gem/ruby/1.9.1/gems/sandrbox-0.1.0/lib/sandrbox/value.rb:90:in `const_defined?': wrong constant name #<IO:0x000000014163c8> (NameError)
<jrajav>
for bad_constants << :STDOUT
<banisterfiend>
jrajav: why dont u just delete STDOUT.send
manizzle has quit [Read error: Connection reset by peer]
<banisterfiend>
or how were they getting IO from it?
<jrajav>
stderr: /home/jrajav/.gem/ruby/1.9.1/gems/sandrbox-0.1.0/lib/sandrbox/value.rb:76:in `call': undefined method `define_method' for #<IO:<STDOUT>> (NoMethodError)
<rontec76>
anyone know why I would get "private method `load' called for MultiJson:Module"? I've verified that "load" is not a private method. I can call that just fine from irb.
<jrajav>
for config.bad_methods << [:STDOUT, :send]
droptable has quit [Ping timeout: 248 seconds]
<Mon_Ouie>
I think you that config expects a class name for some reason
pskosinski has joined #ruby
<jrajav>
But what's the direct class name?
kidoz has joined #ruby
<Mon_Ouie>
There's none. The class object is STDOUT.singleton_class
<jrajav>
Wait. send is a method of Object
<jrajav>
lol
<jrajav>
I don't want to disable Object#send and Object#instance_method
<jrajav>
Not without a way better reason than this
<jrajav>
I think…. I'll just leave the hole in and file an issue with Sandrbox
<Mon_Ouie>
Well, in the end, I think you're going to remove so many features that many simple examples won't work
<jrajav>
Well the only things that are really removed right now are some specific, unsafe Kernel and IO methods that there aren't really any use cases for
<jrajav>
And ObjectSpace
jeff_sebring has joined #ruby
<jrajav>
I know it seems like I've been removing a lot, but I haven't. I've just been trying things one by one to try to block IO
Ancient has joined #ruby
<Chaazd>
I am quite puzzled as to why this will not work: http://pastebin.com/gw6b9EJ5 It's meant to take a sentence, then create a random sentence of the same length. The first letter of the sentence is then pitched against the first element of a shuffled random letter array. If it matches it replaces the first letter of the random word with the first letter of the inputed word. This then goes on to the second letter. However this i
<Chaazd>
input is only one character. It is running the while loop, but it seems the if statement is only run once.
<scant>
i want to convert strings like "new-string-here" to "newStringHere". how do i do this with gsub? my guess is gsub!(/-(.)/,$1.upcase) but idk what i should put where $1 is
nick_h has joined #ruby
telling has quit [Ping timeout: 260 seconds]
wereHamster has quit [Ping timeout: 260 seconds]
telling has joined #ruby
patronus_ has quit [Ping timeout: 265 seconds]
cjk101010 has quit [Ping timeout: 265 seconds]
wereHamster has joined #ruby
KillerFox has joined #ruby
<Mon_Ouie>
use gsub's block form
al2o3cr has joined #ruby
<jrajav>
Okay, well. I'm giving up for now. STDIN and STDOUT are both accessible. You can use them to get IO if you really want. Just.. don't. :P
<jrajav>
>> 'y u so broek'
<al2o3cr>
jrajav: (String) "y u so broek"
<banisterfiend>
>> ls -M
stoffus has quit [Ping timeout: 246 seconds]
aantix has quit [Read error: Connection reset by peer]
<jrajav>
Hanmac: Could you mock up a simple line showing that IO is accessed?
<Hanmac>
virunga ... you are true, but i dont think its SO much difference ...
<virunga>
Mon_Ouie: what do you mean?
<banisterfiend>
virunga: it says it embeds them in the RString struct
<banisterfiend>
virunga: it didnt (afaict) say it stored them on the stack
<banisterfiend>
virunga: when i said T_OBJECT before, i meant T_STRING
<Mon_Ouie>
It just means there's only one call to malloc needed instead of two
nopolitica has quit [Quit: leaving]
<virunga>
banisterfiend: an array of char statically allocated go on the stack
<virunga>
in C
<banisterfiend>
virunga: no..
<Mon_Ouie>
Except The RString structure is dynamically allocated
<banisterfiend>
virunga: when in a function definition yes, but when it's defined inside a struct
<banisterfiend>
virunga: it gets embedded in the struct itself which is allocated on the heap in this case
<virunga>
banisterfiend: that's a definition not declaration
<virunga>
i mean declaration
<banisterfiend>
virunga: you can verify this easily by seeing that the size of the char array increases the size of the struct object, so it's clearly stored there, not on the stack
mengu has quit [Remote host closed the connection]
<virunga>
i know that
<banisterfiend>
virunga: ok, good, then u agree it's not stored on the stack and you're wrong? :)
<virunga>
banisterfiend: as i wrote i meant the definition and declaration of a varaible. In the case u described i agree with u
havenn has quit [Remote host closed the connection]
Guest89851 has quit [Quit: Guest89851]
thecreators has joined #ruby
<banisterfiend>
right...i love it when people say one thing, then find out they're wrong, and pretend they were saying the opposite all along..
<banisterfiend>
anyway bbl ;)
answer_42 has quit [Quit: Lost terminal]
bluOxigen has joined #ruby
havenn has joined #ruby
froy has quit [Ping timeout: 264 seconds]
ph^ has joined #ruby
vvgomes has quit [Ping timeout: 246 seconds]
hadees has quit [Quit: hadees]
mickn has quit [Quit: Ex-Chat]
jorge has joined #ruby
resure has joined #ruby
lorandi has joined #ruby
scriabin_ has joined #ruby
lorandi has quit [Client Quit]
<virunga>
banisterfiend: i said char array statically allocated (which maybe isn't the right term..). Is an array definied inside of a DEFINITION of a struct allocated? No.
<scriabin_>
how do I detect if an array contains a nil value? [1,2,1,nil,1].contains_a_nil?
<scriabin_>
I'm stumped
lorandi has joined #ruby
<Mon_Ouie>
Array#include?
infinitiguy has quit [Ping timeout: 246 seconds]
<scriabin_>
aw that was to easy
<scriabin_>
thanks
<workmad3>
.all? would also work, I believe
Berglund has quit [Quit: Computer died.]
<Hanmac>
i think in this way include? is faster then all?
<Mon_Ouie>
all? would treat false like nil
hakunin has quit [Read error: Operation timed out]
<Mon_Ouie>
TBH I find the non-block form of those methods rather useless
hakunin has joined #ruby
hynkle has quit [Quit: Computer has gone to sleep.]
<banisterfiend>
Mon_Ouie: i often use enum.any? instead of !enum.empty?
<banisterfiend>
though it's not striclty equivalent, the distinction doesn't usually matter for me
maletor has joined #ruby
<Hanmac>
banister [false, nil, false, nil].any?
workmad3 has quit [Ping timeout: 248 seconds]
hynkle has joined #ruby
verto is now known as verto|off
<banisterfiend>
Hanmac: like i said, teh distinction often isn't relevant
<banisterfiend>
Hanmac: in the situations i've been using it [false, nil, false] isn't valid
<banisterfiend>
it must always contain a non-falsey object
<banisterfiend>
so any? is good enough 4 me
fantazo has quit [Remote host closed the connection]
hadees has joined #ruby
adeponte has joined #ruby
ph^ has quit [Remote host closed the connection]
hakunin has quit [Ping timeout: 246 seconds]
banisterfiend has quit [Remote host closed the connection]
geekbri has quit [Remote host closed the connection]
strife25 has quit [Quit: Computer has gone to sleep.]
asteve has quit []
chichou has joined #ruby
krusty_ar has quit [Read error: Connection reset by peer]
verto|off is now known as verto
krusty_ar has joined #ruby
hakunin has joined #ruby
ph^ has joined #ruby
phinfonet has quit [Ping timeout: 265 seconds]
hynkle has quit [Quit: Computer has gone to sleep.]
Russell^^ has quit [Ping timeout: 245 seconds]
mneorr has quit [Quit: Leaving.]
esuzuki has joined #ruby
nemesit has quit [Ping timeout: 248 seconds]
kuranai|off has quit [Remote host closed the connection]
vitoravelino`afk is now known as vitoravelino
esuzuki has left #ruby [#ruby]
TorpedoSkyline has joined #ruby
TorpedoSkyline has quit [Client Quit]
i0n has quit [Quit: Lost terminal]
TorpedoSkyline has joined #ruby
nikl has joined #ruby
<nikl>
hi guys! I experience errors with: libv8 (3.3.10.4), and believe i've been able to change the version to 3.11.8.3 now though
<nikl>
brew install still gives me the same error, again.. (tries to install 3.3.10.4) why? :(
<nikl>
easy fix?
w0lverine has quit [Quit: w0lverine]
<Hanmac>
use an better os like linux
sweetheart has joined #ruby
<nikl>
sorry! i didn't know better :(
<sweetheart>
www.rakenews.com win as you play $1000 /month, register now!
sweetheart has left #ruby [#ruby]
billy_ran_away has quit []
phinfonet has joined #ruby
Guedes0 has joined #ruby
akem has quit [Ping timeout: 248 seconds]
<nikl>
i was told by my geek friend, too late: linux > mac > windows
Taichou has joined #ruby
vvgomes has joined #ruby
bothra has quit [Ping timeout: 245 seconds]
piotr_ has quit [Ping timeout: 248 seconds]
canadadry has joined #ruby
MasterIdler has quit [Quit: MasterIdler]
<canadadry>
anyone free to explain a couple ruby things to me real quick?
<canadadry>
I'd like to know what .map does
<canadadry>
and I don't understand Dir
<canadadry>
and what does it mean to flatten something?
<Hanmac>
candadry whats your os? on linux you could try "ri method"
<canadadry>
debian
gmci has quit [Quit: Computer has gone to sleep.]
reuf has joined #ruby
<canadadry>
wow I didn't know you could do that
pskosinski has quit [Quit: I've got a feeling there's a fish in the floor; I'd better squish it or he'll swim out the door; Sometimes they take me for a walk in the sun; I see my fish and I have to run]
scootiepuff has joined #ruby
Taichou has quit [Ping timeout: 246 seconds]
wmoxam_ has quit [Ping timeout: 246 seconds]
BlackShadow has quit [Remote host closed the connection]
foolove has quit [Quit: Leaving]
greenysan has joined #ruby
robert_ has quit [Excess Flood]
robert_ has joined #ruby
phinfonet has quit [Ping timeout: 272 seconds]
_br_ has quit [Excess Flood]
<shevy>
ewww debian
pskosinski has joined #ruby
<shevy>
canadadry, .map is like "apply this on each element"
<nikl>
quick question.. why does "bundle install" override all my other upgrades of gems? :/
<shevy>
canadadry, for instance say you have an array with 3 elements ... 1,2 and 3 ... then you can use .map like so: [1,2,3].map {|e| e * 3 } # => new array: [3,6,9]
<shevy>
because bundler is a piece of crap that should die? :)
<canadadry>
shevy: not sure if you know, but is .map then equal to in perl saying the following....
<canadadry>
foreach $element(@arrray){
<shevy>
canadadry "apply this on every element"
<shevy>
no
<canadadry>
chomp $element;
<shevy>
that sounds more like, ruby code:
<havenn>
Maglev and Jruby are way ahead by Shaughnessy's benchmark standard.
<canadadry>
}
<shevy>
array.each
<shevy>
no, chomp exists in ruby too
<shevy>
string_object.chomp
<shevy>
or
sailias has quit [Quit: Leaving.]
<shevy>
string_object.chomp!
<shevy>
does perl not have .map ?
_br_ has joined #ruby
<shevy>
well
<nikl>
shevy, do I have any choice now? i'm unfortunately on mac
<canadadry>
ok then why not do array.each instead of .map?
<shevy>
array.map(&:chomp)
codespectator has quit [Quit: Computer has gone to sleep.]
<shevy>
canadadry .map returns the result
<pseudonymous>
Is there a good introduction to how require/include functions in ruby ? I'm trying to write a custom validator in rails but have no idea where to place it or how to include it from a custom directory and all code examples I can find only show examples of the actual validator and its use (which is what I *don't* need help with)
<shevy>
{|f| File.file?(f) unless excludes.include? f }.sort
<shevy>
but
Banistergalaxy has quit [Ping timeout: 240 seconds]
<shevy>
this does not make any sense
<shevy>
cant you translate this into what you need, in english words?
<shevy>
because you use some block operation, but you should either return true or false in it, right?
<shevy>
"if this is a file, unless excludes array includes f"
AndChat| has joined #ruby
<shevy>
doesnt make a lot of sense to me
<canadadry>
print files unless the files are on the excluded file list
<shevy>
but you dont print anywhere
<shevy>
and where is the condition for File.file? in your sentence
<canadadry>
well
<canadadry>
I mean
havenn has quit [Remote host closed the connection]
<canadadry>
it goes back to the main array of log_files
<shevy>
good. return the selection.
mascool has quit [Ping timeout: 240 seconds]
<shevy>
now what is the selection logic you apply here?
burgestrand has joined #ruby
<shevy>
btw
akem has joined #ruby
<shevy>
you could use 2x .select if it makes it easier for you
<shevy>
or .reject
<canadadry>
would it make more sense to take the initial array and pop out any entries that contain something from an exclude list?
<shevy>
%w(abcdef b c d e f).reject {|x| x.size < 3} # => ["abcdef"]
<shevy>
it really does not matter
<shevy>
this is ruby, there is more than one way. .reject or .select, just pick one and continue
mascool has joined #ruby
Gab0 has joined #ruby
<shevy>
foo = %w(b c d f); %w(abcdef b c d e f).reject {|x| foo.include? x } # => ["abcdef", "e"]
<canadadry>
can I say .reject { |x| x.include? excludes }
yakko has joined #ruby
<shevy>
no because .include? does not like an array
<canadadry>
ok
<canadadry>
then...
<canadadry>
excludes.to_s
<shevy>
"abc".include? %w(a b c) TypeError: can't convert Array into String
<shevy>
then you have a string
<shevy>
which you dont want in your example
<shevy>
I mean
<canadadry>
what DO I want?
<shevy>
why have an exclude array if you keep it as a string
<shevy>
only you know :-)
<shevy>
it works if you ask an array whether it includes a string
<shevy>
.reject { |x| x.include? excludes }
<shevy>
to
<shevy>
.reject { |x| excludes.include? x }
froy has joined #ruby
tiripamwe has quit [Quit: Leaving]
enroxorz is now known as enroxorz-towlie
enroxorz-towlie has left #ruby ["Ex-Chat"]
mrdodo has joined #ruby
tiripamwe has joined #ruby
cherrypeel has joined #ruby
<fowl>
do the ricky bobby
<fowl>
stop. pose for the frame
crankycoder has quit [Quit: Leaving...]
mengu has joined #ruby
minijupe has quit [Quit: minijupe]
krz has joined #ruby
verto is now known as verto|off
froy has quit [Read error: Connection reset by peer]
Eldariof-ru has quit [Ping timeout: 246 seconds]
froy has joined #ruby
bothra has joined #ruby
tommyvyo has joined #ruby
strife25 has joined #ruby
<AndChat|>
Strife25 named after the game?
<AndChat|>
Strife
elux has quit [Quit: Bye!]
<canadadry>
shevy:
meskyanichi has quit [Quit: Leaving...]
iamjarvo has quit [Quit: Leaving...]
kernelpa_ has joined #ruby
bothra has quit [Ping timeout: 245 seconds]
minijupe has joined #ruby
luckyruby has joined #ruby
thone_ has joined #ruby
rippa has quit [Ping timeout: 248 seconds]
berserkr has joined #ruby
thone has quit [Ping timeout: 248 seconds]
<shevy>
canadadry what
<shevy>
sorry man
<shevy>
no PRIVMSG, it is too consuming to answer
<shevy>
just ask here
minijupe has quit [Quit: minijupe]
krusty_ar_ has joined #ruby
<shevy>
I also recommend you start irb and test it
mengu has quit [Read error: Connection reset by peer]
<shevy>
it's how I can copy/paste those results
<shevy>
I type it in irb, then I paste it into here
mengu has joined #ruby
mengu has quit [Changing host]
mengu has joined #ruby
krusty_ar has quit [Ping timeout: 244 seconds]
bbttxu has quit [Quit: bbttxu]
kirun has joined #ruby
sailias has joined #ruby
mengu has quit [Remote host closed the connection]
<AndChat|>
Shevy with pry you can gist directly, no need for copy paste
mengu has joined #ruby
mengu has quit [Changing host]
mengu has joined #ruby
<davidcelis>
you can gist directly from pry?
<davidcelis>
sweet fucking jesus
<shevy>
long live pastie.org!
<davidcelis>
that's amazing
burgestrand has quit [Quit: Leaving.]
kernelpa_ has quit [Remote host closed the connection]
<fowl>
yeah pry is pretty kewl
cj3kim has joined #ruby
qwerxy has joined #ruby
Synthead has quit [Quit: p33 ba115]
<AndChat|>
Davidcelis hell yeah
Synthead has joined #ruby
discopatrick has quit [Quit: discopatrick]
jonathanwallace has quit [Remote host closed the connection]
jonathanwallace has joined #ruby
strife25 has quit [Quit: Computer has gone to sleep.]
bluOxigen has quit [Ping timeout: 240 seconds]
User_420 has joined #ruby
<User_420>
Hello everyone.
<tommyvyo>
hello User_420
bluOxigen has joined #ruby
<davidcelis>
User_420: Are you here under the influence?
savage- has quit [Remote host closed the connection]
<User_420>
I have recently decided to learn to program, so I can then teach my son when hes around 5 or 6. I have no experience with programming and think that ruby or python would be a best first language. Can I get some input on what experienced programmers might think of my situation?
<davidcelis>
We're gonna be biased towards Ruby over Python
<User_420>
thats fine
<User_420>
Just honest input on what you think are the strong points for a beginner to use this language
<User_420>
if that makes sense
savage- has joined #ruby
<davidcelis>
It's a general purpose scriping language, which means there's going to be very little you can't do with Ruby
<davidcelis>
scripting*
jasonLaster has quit [Remote host closed the connection]
nikl has quit [Remote host closed the connection]
<davidcelis>
The syntax is clear, readable, and easier to understand than most other languages of its ilk (IMO)
<axl_>
I am trying to email a zip file and am getting the following error: Illegal content type 'application/zip; filename=caselot_mpx_export_for_2012_08_03.zip'
<axl_>
any idea why ?
jonathanwallace has quit [Ping timeout: 246 seconds]
GoGoGarrett has quit [Remote host closed the connection]
<kylesnav>
I would suggest python if you were looking for straight programming, but if any interest of web was involved definetly ruby.
<davidcelis>
It has a huge community backing it, which means tons of available plugins (called gems for Ruby) that you can drop into your application at a moment's notice
<kylesnav>
Ruby docs/community is much better though.
<User_420>
Hrmm...
<User_420>
Thats intriguing
<User_420>
That's
tommyvyo has joined #ruby
<davidcelis>
There's a myth that Ruby is slow (typically the argument is that it's slower than Python), but they're on the same order of magnitude in terms of speed
<User_420>
Well I will want to make web apps for sure, and I am sure for a youngin that would be expected. Sounds like ruby is it then.
<davidcelis>
Definitely suggest Ruby, then, yep
<davidcelis>
I'm guessing you're going to want to dive into Rails, but I urge you to learn the basics of Ruby before you do that.
mpereira has quit [Ping timeout: 250 seconds]
<User_420>
The only reason I was considering python, was because I heard it was SUPER structured.
<davidcelis>
Otherwise, a lot of the shit Rails does is going to seem like magic, which will make learning more difficult
<User_420>
Which I felt would be good for mental development
`brendan has quit [Quit: - nbs-irc 2.39 - www.nbs-irc.net -]
<davidcelis>
Python is structured, i.e. indentation matters, but as long as you're vigilant about structuring your own code, that really doesn't matter as much
<davidcelis>
Where that comes more into play is reading other peoples' code
<User_420>
Indeed
<User_420>
Well I am tidy anyway
<User_420>
Even my html has to look perfect
<User_420>
Thanks a ton for the input guys
<User_420>
I hope you understand that you will have to put up with newb questions from me for a while now =)
<davidcelis>
No prob. Come back when you need help.
<shevy>
then you would know that you need to call a method
MasterIdler_ has joined #ruby
MasterIdler_ has quit [Client Quit]
<shevy>
def [](input)
<shevy>
Dir[f]
<shevy>
^^^
<shevy>
Dir.[f]
<shevy>
hmm
<shevy>
Dir.[](f)
<canadadry>
I don't understand
<shevy>
canadadry you used:
<shevy>
Dir|f|
<shevy>
do you see the difference to
<shevy>
Dir[f]
<canadadry>
log_files is a directory listing that's fed in optsparse
cj3kim has quit [Quit: This computer has gone to sleep]
nicoulaj has joined #ruby
Bidness has quit [Remote host closed the connection]
dv310p3r has quit [Ping timeout: 245 seconds]
MasterIdler has quit [Ping timeout: 246 seconds]
thecreators has quit [Quit: thecreators]
bbttxu has quit [Quit: bbttxu]
kirun has quit [Quit: Client exiting]
jrist is now known as jrist-brb
caveat- has quit [Quit: leaving]
gmci has joined #ruby
<canadadry>
shevy: how should Dir | f | be different?
jrajav has joined #ruby
caveat- has joined #ruby
jasonLaster has joined #ruby
<matti>
caveat-: Dir[
<matti>
Ops
<matti>
canadadry: Dir[] is a Dir object with method []
<User_420>
Wow, very plain and easy to read, even for a complete beginner. Thanks so much for the recommendation guys. I am going to love learning Ruby.
<matti>
canadadry: The Dir['...'] {|i| ... }
<canadadry>
matti: but it works as the original coder wrote it
<matti>
canadadry: |i| is the notation used in blocks.
<matti>
Does it?
<canadadry>
matti: the original line looks like this..
<canadadry>
I wanted to test adding a thing to filter out results of the array I didn't want
<matti>
Oh, fair enough.
havenn has joined #ruby
<matti>
He is collecting everything in a particular directory.
<canadadry>
so I'm going to add a new section in the yaml that's used as a config when rails launches, add a new option to parse for the exclusions, and then have it pull the exclusions from that
<canadadry>
yeah
adeponte has quit [Remote host closed the connection]
<canadadry>
his code makes baby jesus cry
<matti>
LOL
<canadadry>
it's hideous
graft has joined #ruby
<graft>
okay, here's a good chestnut: take a hash indexed by x and y, and return a hash indexed by y and x
flagg0204 has quit [Quit: leaving]
<graft>
like hash[x][y] = something
<shevy>
canadadry I think you should stop trying to fix code other people wrote and instead write your own code
statarb3 has joined #ruby
Speed has joined #ruby
Speed has quit [Changing host]
Speed has joined #ruby
jasonLas_ has joined #ruby
<canadadry>
shevy: I don't want to have to do a big project for my company if I can tweak an open source one that's a little immature and make it more suitable
<apeiros>
log_files.map {|f| Dir[f] }.flatten.compact.uniq.select{|f| File.file?(f) }.sort <-- compact is unecessary, use flat_map instead of map.flatten
jonathanwallace has joined #ruby
<canadadry>
apeiros: how is flatten different from flat_map?
<apeiros>
alternatively might use inject([]) { |r,f| r | Dir[f] } and remove uniq too
nicoulaj has quit [Remote host closed the connection]
<scant>
graft: fastest way would be to use a new hash and copy values in with a new index, right?
<apeiros>
canadadry: flat_map does map + flatten in one go
kvirani has quit [Remote host closed the connection]
<canadadry>
so if I make an exclusion list and ad it on that way at the end?
<davidcelis>
apeiros: Just certain stuff not documented well, like how bad xml namespaces will silently make xpath and css not work
<apeiros>
canadadry: bad code… that reject is O(n*m), could have it O(n+m) easily and even with less code by using `result - excludes` instead of that reject thing…
<davidcelis>
apeiros: I've had XML with (unbeknownst to me) bad xmlns attributes that silently made any xpath or css attempts fail. I finally stripped the namespacing in frustration and then it worked
greenysan has quit [Ping timeout: 246 seconds]
<davidcelis>
I had to really dig into the docs to find out how or why to do that, though, and it was not a fun process
resure has quit [Remote host closed the connection]
adeponte has joined #ruby
<canadadry>
0(n*m)?
<scant>
davidcelis, can you help me with nokogiri? i have a weird issue like that
jonathanwallace has quit [Ping timeout: 272 seconds]
<Spooner>
But really, it is impossible to fix code unless you know what it is supposed to do.
Berglund has quit [Quit: Computer died.]
<dvolker>
yeah i don't get it.
jasonLas_ has quit [Remote host closed the connection]
<Spooner>
Well, a number of things. Why are you wanting to make unique something which is, by definition, not repetetive (Dir[whatever] doesn't return duplicates).
jasonLaster has joined #ruby
kpshek has quit []
<Spooner>
Oh no, I suppose flat_map might end you up with duplicates, depending on what log_files contains (so ignore me, perhaps).
nateberkopec has joined #ruby
regedarek has joined #ruby
<regedarek>
Hello guys Is ths a true that ruby have problem with Xcode 4.4, so wich version of xcode should i install??
<Spooner>
canadadry : To more directly answer your question, File.file?(f) is true if it is a file. No such method as File.file(f)
sevvie has quit [Quit: sevvie]
IPGlider has quit []
<Spooner>
canadadry : Do you realise that line #2 doesn't actually alter the value of log_files at all, so it is ingored in #3 and #4. Again, can't really fix it because I'm not sure what the intention is, or what "log_files" contains.
jasonLaster has quit [Ping timeout: 246 seconds]
<canadadry>
Spooner: why doesn't it alter the valie?
<burgestrand>
regedarek: XCode 4.1 should be safe.
jgarvey has quit [Quit: Leaving]
kenichi has quit [Remote host closed the connection]
<davidcelis>
regedarek: depends on the ruby version
<burgestrand>
regedarek: using the newer versions should be avoided if you are not comfortable playing around in the terminal, it might need some extra steps to set up correctly.
<Spooner>
canadadry : Well, because it doesn't. Methods like flat_map and uniq and select don't change the original collection, but rather return a modified version. uniq! or select! would change the original collection, but you can't just chain those like that. I think what you want is log_files = log_files.flat_map...etc
<Spooner>
But log_files is, by the look of it, a local variable, so you don't have access to in inside the method. If it is a method, then you can't alter it as you seem to want to to.
<canadadry>
it's a variable that's a little more than local
<canadadry>
it really should be a class variable but the guy who wrote it didn't do it that way
SCommette has quit [Quit: SCommette]
<Spooner>
"A little more than local" is perhaps the best thing I've heard in a while.
<dvolker>
lol
jfelchner has joined #ruby
<canadadry>
it's defined in the opening arguments when the rails app launches and then passed around by a few different ruby scripts
<dvolker>
is a little more than local a yokle
<canadadry>
eventually it gets printed to a drop list
<Spooner>
Yes, but that method can't see it.
<canadadry>
the main part has attr_accessor on it
<canadadry>
to allow it to
<Spooner>
So you need to pass it in.
droptable has quit [Ping timeout: 240 seconds]
<Spooner>
Ah, then it isn't a variable per se, but a method. Yes, so it can be accessed, but you can't then just use log_files -= excludes on it.
verto is now known as verto|off
uris has quit [Quit: leaving]
berserkr has quit [Quit: Leaving.]
<Spooner>
canadadry : Seriously, you need a proper grounding in Ruby. You really can't edit other people's files with so many holes in your knowledge, that are on such a fundamental level.
mrsolo has quit [Quit: Leaving]
SQLStud has quit [Read error: Connection reset by peer]
bradhe has quit [Remote host closed the connection]
havenn has quit [Remote host closed the connection]
savage-_ has joined #ruby
Synthead has quit [Remote host closed the connection]
savage- has quit [Read error: Operation timed out]
mpereira has joined #ruby
javon has joined #ruby
tompsony has joined #ruby
ringotwo has joined #ruby
Jay_Levitt has quit [Ping timeout: 248 seconds]
Chryson has joined #ruby
chimkan has joined #ruby
akem has quit [Quit: Forget progress by proxy. Land on your own moon.]
danielvdotcom has joined #ruby
jonathanwallace has joined #ruby
akem has joined #ruby
akem has quit [Changing host]
akem has joined #ruby
<shevy>
yeah
<shevy>
this is the basics
<shevy>
<canadadry> it really should be a class variable but the guy who wrote it didn't do it that way
<shevy>
class variables are @@foo
<shevy>
they are not very useful
Goles has quit [Quit: Computer has gone to sleep.]
danielvdotcom has left #ruby [#ruby]
droptable has joined #ruby
sebastorama has quit [Quit: Computer has gone to sleep.]
<Spooner>
canadadry : Do ask questions here though. Not saying you shouldn't, of course :)