apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
<kallisti>
the special case is: a, b, c, ... = some_array
<kallisti>
the arrays elements are assigned to the list of variables
<heftig>
yes.
<kallisti>
that's a weird general case. :P
<heftig>
no, that's the regular list assignment case
<heftig>
you have a list of 3 on the left side and a list of 1 on the right side
<shadoi>
jaysern: did you ever try pointing it at the header files you found last time?
<kallisti>
heftig: so then the expression on the right side is implicitly treated as a length-1 list...
<shevy>
checking for archive.h... no
<shevy>
jaysern you probably lack all headers from libarchive
<shevy>
let me guess jaysern this is debian right?
<kallisti>
I realize this is a trivial thing to be discussing, but I'm trying to wrap my mind around it.
<jaysern>
os x 10.6 snow leopard
<heftig>
kallisti: you're doing list assignment, of course it's treated as a list
<kallisti>
heftig: so was it because I said "length-1 array" originally that made it false, instead of "length-1 list"
<heftig>
yes
<kallisti>
ah I see
<kallisti>
a, b = 1, 2
<kallisti>
this works fine
<kallisti>
?
<heftig>
yes.
<kallisti>
the "list" is a syntactic thing. the special case is that an array is expanding into a "list"
<kallisti>
got it.
<heftig>
yes.
<kallisti>
*expanded
kish has joined #ruby
bwlang has joined #ruby
<robacarp>
a, b, c = b, c, nil
carlyle has joined #ruby
<robacarp>
^ also valid
<heftig>
a, b = b, a for one-line swapping
<jaysern>
am i passing it wrong? gem install libarchive -v '0.1.2' --with-opt-include=/usr/libERROR: While executing gem ... (OptionParser::InvalidOption)invalid option: --with-opt-include=/usr/lib
<kallisti>
heftig: I was confused because someones example earlier used an array directly. a, b, c = [1,2,3] like this
<shadoi>
jaysern: yes, point it to the location where you found archive.h
<heftig>
kallisti: yes, but that explains why a, b, c = "foo bar baz".split works
<kallisti>
heftig: yes
<kallisti>
so it works very similarly to the way perl list assignment works, but with different underlying semantic reasons.
<jaysern>
gem install libarchive --with-opt-include=/usr/lib <-- gem is saying --with-opt-include is wrong
<shadoi>
because it's wrong.
<shadoi>
the header file isn't in /usr/lib
tommyvyo has joined #ruby
<heftig>
kallisti: the stuff gets even more complex if you introduce parentheses
ussher_ has joined #ruby
<kallisti>
heftig: (a,b),c = ... # like this?
<heftig>
yes
<kallisti>
I can grok that.
<kallisti>
already
<jaysern>
well .. it's saying invalid option - not complaining about the directory
<kallisti>
heftig: Haskell has pattern matching, which takes this kind of stuff to a whole new level. So this is still pretty tame.
<kallisti>
nice.
<kallisti>
good to know that's possible.
kish has joined #ruby
<kallisti>
is there a way to assign the remainder of an array to a variable?
<heftig>
splat
<td123>
a, *b, c = (1..4).to_a
<heftig>
a,(b,c,*d),e = 1,[2,3,4,5],6
<jaysern>
when i do a brew install libarchive, it says: Error: No available formula for libarchiveApple distributes libarchive with OS X, you can find it in /usr/lib.
<td123>
a = 1, b = [2,3], c = 4
<kallisti>
ah
<shadoi>
jaysern: try just --with-opt-include, no argument (I think you said this is where it was last time on 10.5)
<kallisti>
cool
Divinite has joined #ruby
<heftig>
a,(b,c,*d),*e,f = 1,[2,3,4,5],6,7,8
<kallisti>
ah and that works like vararg function arguments as well
<kallisti>
same principle
<kallisti>
same syntax
<heftig>
yes
<jaysern>
shadoi: i upgraded to 10.6 from 10.5 since i couldn't get it to work
<kallisti>
(method, I should say. you know what I mean. :P )
<heftig>
yes :p
<shadoi>
but PLEASE don't ever do it! :)
* kallisti
thinks he'll enjoy Ruby as his scripting language of choice.
__class__ has joined #ruby
krzkrzkrz has joined #ruby
<heftig>
def foo(a,(b,c)); p a,b,c; end
<heftig>
i don't think anypony does this
<kallisti>
and ** is... to_h?
* kallisti
is just guessing.
<heftig>
kallisti: no
<heftig>
** only exists as a binary operator, which does power
<shevy>
** is power
<kallisti>
right
<shevy>
2 ** 2
<shevy>
4
<kallisti>
okay so then are there variadic hash arguments?
kish has joined #ruby
<heftig>
there's another syntactic things
<shevy>
what is a variadic hash argument?
<heftig>
foo :a => 3, :b => 4 is the same as foo({:a => 3, :b => 4})
<kallisti>
ah
<heftig>
you can add such a "loose" hash to a call. it's always the last argument
<kallisti>
aha
Chryson has joined #ruby
<heftig>
which is pretty nice. foo a: 3, b: 4, c: 5 looks like named arguments
<kallisti>
no parentheses required?
<heftig>
nope
<heftig>
optional.
<kallisti>
always? or just with that syntax?
<heftig>
well, as long as the syntax doesn't become ambiguous
<heftig>
always.
<kallisti>
oh..
<heftig>
foo bar 3, 4 is ambiguous
<kallisti>
Why lied to me (granted I haven't endured the whole book)
<shadoi>
that's 1.9.3 only also
<heftig>
the a: 3 syntax is 1.9
<kallisti>
oh okay. so it's a pretty new thing.
<heftig>
the rest is 1.8
<heftig>
(or earlier)
<kallisti>
ah
<shadoi>
oh weird, I thought I saw the a: 3 syntax in the 1.9.3 changelog
m_3 has joined #ruby
<kallisti>
Perl does that kind of stuff pretty happily
<kallisti>
foo bar 3, 4 I mean
<kallisti>
but the Perl parser is not for mere mortals to understand.
<heftig>
ruby spits out a warning
Vert has joined #ruby
<heftig>
i'm not sure what exactly the precedence is, but using parentheses would be better
<kallisti>
yeah
<kallisti>
in Perl it uses knowledge of its builtins and how many arguments they require.
<kallisti>
and things like that.
kish has joined #ruby
<heftig>
ruby doesn't have many builtins
<kallisti>
right
<heftig>
the only one i can recall now is defined?
<kallisti>
Array[1,2,3,4] woah, that's some inventive use of the [] operator.:P
<heftig>
well, Hash's [] method is special-cased again if you supply a single array
<kallisti>
I was about to ask. :)
<heftig>
Hash[[[1,2],[3,4]]]
<kallisti>
is that a general rule? obj.method(array) flattnes the array?
<kallisti>
or is that only the case with a * argument?
<heftig>
no, it's not general
<shadoi>
flatten and * are different things in ruby.
<kallisti>
I see Array has #[](*args)
<heftig>
*arg calls .to_a if it's not an array, and then expands
<kallisti>
right
<shevy>
it collects into args, so you can use any amount of arguments to this method
<kallisti>
but if it were: #[](args)
<kallisti>
that wouldn't happen
<shevy>
that would be one argument called "args"
<kallisti>
got it.
<heftig>
well, *args as a function argument just collects all args into an array
<heftig>
if you supply a single array, then you get an array in the array
<heftig>
the function would then need code to handle this as a special case
<heftig>
(s/function/method/(
<kallisti>
oh, which is what Array#[] does
<kallisti>
oh nevermind
<kallisti>
it doesn't do that.
<heftig>
nope
<kallisti>
you have to use *
<heftig>
but Hash.[] does
<heftig>
(not Hash#[])
<kallisti>
right that's what I meant
<kallisti>
Hash[[1,2,3,4]] returns {}
<heftig>
yes. if you supply an array, it expects it to contain pairs
<kallisti>
am I missing something?
kish has joined #ruby
<kallisti>
ah
<kallisti>
> Hash[[[1,2],[3,4]]]
<kallisti>
=> {1=>2, 3=>4}
<kallisti>
there we go
<kallisti>
that's kind of weird. but okay. :P
albemuth has joined #ruby
<heftig>
only weird if you write it with a literal like that
<kallisti>
well the overloading is a bit odd.
<kallisti>
could easily just be 2 seperate methods
<kallisti>
the syntax isn't an issue.
krzkrzkrz has joined #ruby
<kallisti>
it's bad when I have to explicitly try to find official reference material when googling around, instead of Some Guy's Poorly Written Blog.
krz has joined #ruby
redgetan has joined #ruby
kish has joined #ruby
davidpk has joined #ruby
<heftig>
kallisti: googling doesn't send you to ruby-doc.org?
<kallisti>
well I searched "ruby case statement"
* kallisti
is in the right place now
<kallisti>
maybe I should have searched for "case expression"
Targen has joined #ruby
machine2 has joined #ruby
jmeeuwen_ has joined #ruby
<heftig>
kallisti: ===, if implemented, tends to not be commutative
stephenjudkins has joined #ruby
<kallisti>
out of curiosity, anyone here know Haskell?
<kallisti>
heftig: yes I see that
kish has joined #ruby
<td123>
kallisti: what's your question?
chson has joined #ruby
<kallisti>
there isn't one anymore. :P
localpc4 has joined #ruby
<kallisti>
the question I never asked was "how do case expressions work, in detail?" turns out references are pretty good at answering that question.
shevy has joined #ruby
zakwilson has joined #ruby
krzkrzkrz has joined #ruby
kish has joined #ruby
tommyvyo has joined #ruby
krz has joined #ruby
looopy has joined #ruby
niku4i_ has joined #ruby
kish has joined #ruby
ed_hz_ has joined #ruby
youdonotexist has joined #ruby
ben225 has joined #ruby
<localpc4>
I m ruby newbie -while i run irb, can i run it with my custom ruby scripts? so i could use those functions
<localpc4>
got it, load "file"
kish has joined #ruby
<jaysern>
thanks so much guys
replore has joined #ruby
<kallisti>
I'm using _ as a throwaway variable in a list assignment
<kallisti>
is there a more idiomatic way?
<kallisti>
_, a, b, c = ...
<kallisti>
I don't use _
adamkittelson has joined #ruby
<Veejay>
a, b, c, d = *some_array and then go on to work with b, c and d
<Veejay>
Or some shift followed by an assignment
goldenwest has quit [#ruby]
<lectrick>
I'm trying to YAML a complex object and filter which sub-objects get YAML'ed. This turns out to be hard if there is not a simple hash involved. Anyone have any ideas?
kish has joined #ruby
<lectrick>
Basically I need to serialize and deserialize a request.headers object that has crazy other objects in it like IO objects which toss errors when I try to deserialize
davidpk has joined #ruby
kish has joined #ruby
explody has joined #ruby
Cache_Money has joined #ruby
khakimov has joined #ruby
redgetan has quit ["Leaving"]
<kallisti>
is there anything like Perl's <>
<lectrick>
and i keep getting "uninitialized constant Syck::Syck" when I try to YAML.load :(
<lectrick>
kallisti: is that a not equal comparison? !=
<kallisti>
no
FACEFOX has joined #ruby
<kallisti>
it's reads all command line arguments as filepaths, reads them in order, or reads STDIN if no arguments are given
dfamorato has joined #ruby
kaos01 has joined #ruby
thecreators has joined #ruby
<kallisti>
either as a list or as a iterator
<kallisti>
so like..
<kallisti>
for (<>) { ... }
<kallisti>
the loop variable iterates over every line in every file passed as arguments, or STDIN if none are provided.
<kallisti>
I can write the logic myself if nothing like that exists.
dfamorato_ has joined #ruby
llaskin has joined #ruby
<llaskin>
is there a way to say "if X is a string" or "if X is an array"
<kallisti>
obj.kind_of? Array
<llaskin>
awesome
<kallisti>
llaskin: oh also: it's a small world on Freenode, I guess. :P
<llaskin>
hah kallisti yes
<llaskin>
i'm primariliy a rubyist
* kallisti
just joined here today.
<kallisti>
my first day writing Ruby code, even. :D
<llaskin>
cool
<llaskin>
i come in to ask random questions sometimes
<llaskin>
i'm still learning:)
davidpk has joined #ruby
kjellski_ has joined #ruby
<llaskin>
kallisti: you can help me doc out the ruby apidocs for selenium if you want
<llaskin>
thats my main task for the project
sgcoder has joined #ruby
<kallisti>
perhaps later.
sgcoder has joined #ruby
Bosma has joined #ruby
FACEFOX-DOT-COM has joined #ruby
<lectrick>
arg. when I say YAML.dump obj, I get an error "wrong number of arguments (1 for 0)". When I just call YAML.dump, I get "wrong number of arguments (0 for 1)" This whole fricking YAML/Syck/Psych thing is a big headache
__class__ has joined #ruby
tommyvyo has joined #ruby
stercor has joined #ruby
<stercor>
Where can I find a parenthesis/bracket matching program?
igotnolegs has joined #ruby
prometheus has joined #ruby
<kallisti>
stercor: you could just write one
<kallisti>
it's a simple stack machine.
<stercor>
That's what I don't want to do. I just want it to work. And, no, I'm not a student.
<stercor>
Is there a Ruby code farm?
fivetwentysix has joined #ruby
<stercor>
I have a LaTeX document and I can't find the unmatched {}.
Boohbah has joined #ruby
ssnt has joined #ruby
dankest has joined #ruby
ben225 has joined #ruby
<kallisti>
stercor: are you implying that students are the only ones that write actual code? :P
<stercor>
kallisti: Not at all. But students come to IRC channels looking for someone to write an assignment for them.
pdtpatr1ck has joined #ruby
<kallisti>
ah yes
<kallisti>
stercor: do you only need to match brackets or are you actually parsing other stuff as well?
<stercor>
kallisti: Brackets.\
<kallisti>
and you basically just want a boolean if they match or not?
<stercor>
kallisti: Be nice to tell where they are so I can fix it.
<stercor>
I'm using vim yet again.
<stercor>
One alternative is to comment half the code, see whether the error still exists, Binary search.
akem has joined #ruby
qos has joined #ruby
<stercor>
Found it.
mpereira has joined #ruby
<localpc4>
what does this mean?
Drewch has joined #ruby
<localpc4>
Float(self) != nil rescue false
joukokar has joined #ruby
<looopy>
not exactly the right place to ask this but has anyone ever changed homebrews permissions to 777?
<shevy>
localpc4 that is horrible code IMO
machine1 has joined #ruby
kiwnix has joined #ruby
Advant has joined #ruby
<Advant>
I'm trying to run a ruby script, Cygwin env, that requires libz, and I've installed it but keep getting this error, `ffi_lib': Could not open library 'z':. Its looking for libz.so, Any ideas?
thams has joined #ruby
linoj has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
<shevy>
no idea
sgcoder has joined #ruby
thams has joined #ruby
<shevy>
omg, I am starting to document my methods in one huge line :(
<shevy>
def foo # this kills the world
<shevy>
do_something_here
<shevy>
end
apok_ has joined #ruby
Clordio has joined #ruby
nobitanobi has joined #ruby
Gekz has joined #ruby
Gekz has joined #ruby
jitesh_shetty has joined #ruby
<nobitanobi>
I have a question... When I type "hello world" in the IRB, what does the console return?
<nobitanobi>
is it object.inspect?
<shevy>
the string I suppose
<nobitanobi>
the object itself
<nobitanobi>
?
<shevy>
"hello world"
<shevy>
# => "hello world"
<shevy>
seems so
Advant has quit [#ruby]
<nobitanobi>
yeah, so is the object itself... mmm
<shevy>
:)
CheeToS has joined #ruby
nobitanobi has joined #ruby
c0rn has joined #ruby
ryan0x2 has joined #ruby
nobitanobi has joined #ruby
davidamcclain has joined #ruby
ahmdrefat has joined #ruby
savage- has joined #ruby
radic_ has joined #ruby
josefig has joined #ruby
josefig has joined #ruby
Boohbah has joined #ruby
nobitanobi has joined #ruby
visof has joined #ruby
pythagorasbaum has joined #ruby
zakwilson has joined #ruby
nobitanobi has joined #ruby
Boohbah has joined #ruby
eywu has joined #ruby
nobitanobi has joined #ruby
dkissell has joined #ruby
albemuth has joined #ruby
Chryson has joined #ruby
banisterfiend has joined #ruby
nobitanobi has joined #ruby
<banisterfiend>
kallisti: just put * before the Enumerator
ahmdrefat has joined #ruby
freeayu has joined #ruby
andrewhl has joined #ruby
abra has joined #ruby
dv310p3r has joined #ruby
mikepack has joined #ruby
nobitanobi has joined #ruby
brngardner has joined #ruby
nilg` has joined #ruby
liluo has joined #ruby
nobitanobi has joined #ruby
banister_ has joined #ruby
lewis has joined #ruby
prometheus has joined #ruby
banisterfiend has joined #ruby
freeayu_ has joined #ruby
zakwilson has joined #ruby
emmanuelux has joined #ruby
maletor has joined #ruby
joukokar has joined #ruby
<heftig>
kallisti: <> equivalent is ARGF
looopy has joined #ruby
<heftig>
if ARGV is empty, ARGF reads from STDIN. otherwise, it takes ARGV as filenames and concatenates their contents
<heftig>
ARGF.each_line { |line| ... }
pjn_oz has joined #ruby
<heftig>
so if received any options, make sure those are parsed (using OptionParser or whatever) and removed from ARGV before you try to read from ARGF
robacarp_ has joined #ruby
SegFaultAX|work has joined #ruby
ooldirty has joined #ruby
frogstarr78 has joined #ruby
zakwilson_ has joined #ruby
<lewis>
anybody in here learned ruby before rails?
<lewis>
Actually what I meant to say is , is there someone who learned it for the sole purpose of using ror. If yes, when did you decide to jump to rails; did you practice your ruby first or did you directly learned rails then applied ruby to it
<epochwolf>
lewis: why do you ask?
<lewis>
epochwolf: up
<musl>
lewis: Yep, but not before rails was available. :)
<epochwolf>
lewis: why does it matter if I learned rails or ruby first?
<lewis>
musl: I see
nobitanobi has joined #ruby
ahmdrefat has joined #ruby
<musl>
lewis: Do you mean chronologically before rails or just order of learning? I still don't know rails all that well...
<lewis>
epochwolf: well my problem is when you don't practice you forget things, you could finish an entire ruby book but if you don't get your hands dirty the foundations you've just learned are not solid
<nobitanobi>
lewis: I did learn Ruby before learning Rails (chronologically speaking)
<epochwolf>
lewis: it's kind of like asking me "Did you learn IRC or Lua first?"
<nobitanobi>
lewis: let's say I started learning Ruby before learning Rails :P
<epochwolf>
lewis: I learned both at the same time on a job.
<epochwolf>
I am proficent with ruby with or without rails.
<lewis>
so my dilemma is whether I should practice , waiting until I consider myself a good rubyist and do as many dummy program as I can before I move to rails or move to rails learn about it and apply ruby as I go
<epochwolf>
lewis: you can learn them both at the same time.
<nobitanobi>
+1 ^
<epochwolf>
lewis: if you can learn to read both ruby and rails documenation, you can figure out what's ruby and what's rails.
<epochwolf>
I did that on Rails 1.2 and ruby 1.8
<musl>
I've found that some folks can't separate the std libs from rails / activesupport.
<epochwolf>
musl: I have problems with that :D
emmanuelux has joined #ruby
<musl>
People pull in AS for a couple functions in really trivial scripts. Makes me a little irritated sometimes.
<lewis>
nobitanobi: and did you move to rails right after learning the basics or did you practice
<epochwolf>
musl: I'm primarily a rails developer. So when I go off rails, I need to read the docs and refresh my memory of what's rails and what's ruby.
<musl>
hehe
<epochwolf>
musl: I don't pull in active support unless I'm doing date heavy stuff.
<epochwolf>
date/time*
<musl>
One of the curses among the myriad blessings of monkeypatching.
<musl>
epochwolf: I believe you. :)
<nobitanobi>
When I started learning Rails I knew some basic Ruby...And I am still learning both.
khakimov has joined #ruby
<lewis>
epochwolf: what Im asking is what is going to be more practical. I assume that the time it's gonna take me to learn rails is some time I'm gonna waste by forgetting some ruby..before i actually start combining both
<epochwolf>
lewis: um...
<epochwolf>
lewis: you can learn both at the same time.
<epochwolf>
grab yourself a book on ruby 1.9 (someone here can recommend a good one)
<lewis>
epochwolf: a well grounded ruybist
<lewis>
what book would you advise for rails
<robacarp_>
lewis: I learned both at the same time.
<epochwolf>
and then grab Rails 3 in Action (disclosure, I know the author and I'm helping him proof the second edition)
<robacarp_>
but I'd been programming for ~12 years at that point, so ymmv
lucasefe has joined #ruby
<epochwolf>
I was programming for about 2 years before I started rails.
<lewis>
epochwolf: I'm not getting this book. no offense to radar but I don't quite like the writing style
zakwilson has joined #ruby
<epochwolf>
lewis: no offense taken.
<lewis>
epochwolf: but I'll give it a second change. in his defense I've just flipped through
<prometheus>
to his/their credit, at least it teaches you to test from the get go and not as a passing after thought
<lewis>
robacarp_: what books did you use( I know it comes up a lot). I guess different individuals have different ways to retain information
<epochwolf>
prometheus: that would have been useful 5 years ago :/ almost 5 years rails experience and I didn't learn testing until last year.
<prometheus>
epochwolf: but for someone new to rails/ruby it's immensely useful
<prometheus>
(and new to testing, I should add)
<lewis>
prometheus: also most of you guys are not the perfect audience to convince me, you already know some rails. If it was coming from someone who doesn't know rails at all and learned it all directly from his book it would have more weigh. (I volunteer to be this reviewer)
* lewis
smiles
<prometheus>
lewis: I don't know rails
<prometheus>
well, I do, but all of that is from another book
<lewis>
prometheus: hmm and that's the first book you ever used?
<lewis>
exactly!
<prometheus>
but I wish I had read this r3ia
<prometheus>
instead
<prometheus>
maybe not the first edition, but the second edition has been a good read so far
<lewis>
I have yet to meet someone who just read it with zero knowledge
<prometheus>
lewis: just pick up a book and work through ti :)
<prometheus>
it*
<lewis>
prometheus: don't underestimate what you learned with the previous book, the book might have been crap but you did learn things
<prometheus>
just read some reviews on amazon/goodreads/whatever site you prefer and pick a book :)
<lewis>
prometheus: good advise.
<epochwolf>
lewis: I had the first edition of Agile Web Development with Rails.
<robacarp_>
lewis: I used the oreilly ruby pocket reference, oreilly learning rails, and _most of all_, ruby-doc.org / api.rubyonrails.org
<prometheus>
that's how I've picked my ruby books
jfelchner has joined #ruby
<prometheus>
I've asked for some recommendations on irc, but mostly gone off my own intuition
<prometheus>
lewis: the first ruby book I read was the rspec book :)
<robacarp_>
the hardest thing about the internet is that there are so many tutorials that are out of date in the rails world...it changes too much. Ruby, on the other hand, is more or less stable and the docs are quite up to date.
<lewis>
prometheus: and after you were done with it, you jumped to rails right away?
<prometheus>
nope
<prometheus>
I read ruby books
<TTilus>
prometheus: good choise for a first book
<prometheus>
well grounded rubyist, eloquent ruby
<prometheus>
design patterns in ruby, metaprogramming..
<prometheus>
objects on rails
<lewis>
prometheus: I'm confused, ....do you read all of them at the same time
* lewis
can't multitask
<prometheus>
lewis: about 2-3 books at a time
<lewis>
prometheus: what's the point
* TTilus
also recommends reading/studying ruby codebases
<prometheus>
when I get bored with a book, I'll read another for a bit :)
<epochwolf>
robacarp_: it doesn't help that the primary tutorial has some bad parts in it that I keep having to explain to newbies at the rails meetup in seattle. :/
<prometheus>
nothing beats reading good source code, though
<lewis>
robacarp_: and did you use those books in order..
<lewis>
TTilus: ruby codebase?
<prometheus>
lewis: bottom line is, read/study something :)
<prometheus>
start somewhere
<prometheus>
that's the most important step
<TTilus>
lewis: code of apps written in ruby
<lewis>
prometheus: I'm almost done with a well grounded rubyist
ahmdrefat has joined #ruby
<prometheus>
there you go :)
<lewis>
prometheus: that's why i was thinking about the next step. and I have some basics with few programming language
<lewis>
TTilus: can you link me
<prometheus>
lewis: I think that depends on where you want to go
<lewis>
robacarp_: i meant chronoligically...or did you read them like prometheus all at the same time...like prometheus himself
<robacarp_>
lewis: I didn't read them, I referenced them when I was confused.
<lewis>
prometheus: the goal is ror
<TTilus>
lewis: go to github and look for oft watched/forked ruby projects
<TTilus>
lewis: ruby stdlib is a good start
<prometheus>
lewis: I'd say get a rails book then, because you'll know enough ruby to understand how things work
<prometheus>
or at least, be able to read and study the code :)
<lewis>
prometheus: epochwolf suggested that i grab a rail book when im done and start learning, that i should not worried about losing some of my ruby I've just learned..
<TTilus>
lewis: and of course rails
<lewis>
worry*
<prometheus>
lewis: there isn't that much syntax to remember, tbh
<prometheus>
and rails code is just ruby
<lewis>
robacarp_: hmm
<robacarp_>
just dive in, youll do fine.
<prometheus>
yup
<TTilus>
lewis: and while you read the code try to figure out what it does, how and why
<prometheus>
I just read a lot of books because I had time to do that :)
<epochwolf>
lewis: you'll use ruby stuff.
<TTilus>
lewis: and of course, try to disagree with design coises
<epochwolf>
lewis: jut remember, you have the book and you can look up ruby stuff if you need to
<lewis>
robacarp_: ok thanks. epochwolf. i shall talk to you guys when im done with rails
<lewis>
epochwolf: and ill go over radar book again, just in case
<robacarp_>
lewis: you can always ask your questions in here and #rubyonrails, people are *usually* pretty nice
<lewis>
TTilus: thanks man
<lewis>
robacarp_: i usually hang in #math, so you shall see that happen
<prometheus>
this channel is infinitely nicer than #python, fwiw ;)
<lewis>
haha
<lewis>
infinitely nicer than C
<prometheus>
there's a lot of grumpy people over at #python
<lewis>
#C
<epochwolf>
lewis: I have no clue what robacarp_ is talking about. I'm a troll.
* epochwolf
helps those who help themselves, everyone else gets trolled.
<robacarp_>
man, if you want some real scowlers, #haskell
<prometheus>
:)
<robacarp_>
elitest bastards.
<epochwolf>
robacarp_: okay, they make me look like a tribble.
<lewis>
robacarp_: haha really, I heard #haskell is just a different way of thinking. I was talking with someone last time who was telling why it's ten years ahead and languages like ruby can't compare aha
thams has joined #ruby
thams has joined #ruby
<epochwolf>
lewis: if it's anything like lisp, it's not going to work.
<robacarp_>
epochwolf: there is so much of the world to which I just stare at in amazement before walking away.
apok has joined #ruby
<epochwolf>
robacarp_: sorry, I really love that cartoon. There was a real dearth of good cartoons when I was a kid. I'm making up for lost time.
macmartine_ has joined #ruby
<banisterfiend>
lewis: why did u put a # in front of haskell
<robacarp_>
its not that I'm saying its not amazing, its that I'm wholly clueless... :-/
<lewis>
epochwolf: I have no idea...needless to say that kind was convincing.
<epochwolf>
banisterfiend: too much twitter has poisoned his brain.
<lewis>
banisterfiend: I'm not sure actually...
<epochwolf>
lewis: I've tried to understand haskell but I've gotten no where.
<robacarp_>
banisterfiend: to reference the chat room...
<epochwolf>
robacarp_: no, stick to the poisoning theory!
<banisterfiend>
robacarp_: didnt qutie make sense in that context homie
<lewis>
haha epochwolf, banisterfiend maybe too much ruby...method haskell of the a class
niklasb_ has joined #ruby
<lewis>
banisterfiend: i thought i was the only one who said homie on irc
<robacarp_>
banisterfiend: yes it did, homie. because we were just talking about #C and #python and #haskell.
<epochwolf>
lewis: he not be the only one, brah
<banisterfiend>
robacarp_: "i heart "the IRC channel haskell" is a different way of thinking?"
<banisterfiend>
heard*
<lewis>
lol
<lewis>
superclass troller?
<epochwolf>
banisterfiend: that interpretation makes more sense than the language actually being a different way of thinking.
<lewis>
why is haskell sounds like the next best thing...everybody is trying to learn it
<epochwolf>
lewis: everybody?
<banisterfiend>
lewis: did you mean "the irc channel haskell is a different way of thinking" or did u mean "haskell (the language) is a differetn way of thinking" ?
* robacarp_
gets out knife, starts splitting hairs
<lewis>
banisterfiend: according to this guy...it throw of anyone who's used to OOP
<banisterfiend>
lewis: ah, so you meant the language :)
banjara has joined #ruby
<lewis>
it's a procedural language with a different approach to my understanding
<lewis>
thorws8
<banisterfiend>
robacarp_: looks like you were wrong, homie.
<lewis>
throws*
<robacarp_>
that word makes me twitch, homie.
<banisterfiend>
robacarp_: i do not like to be teased by foreigners about mathematical things
<robacarp_>
...wha
<epochwolf>
lewis: if it's anything like lisp, it won't work.
<lewis>
banisterfiend: Einstein was right
<epochwolf>
lewis: haskell is funcitonal, not procedural.
<lewis>
epochwolf: what's the difference
* lewis
smiles
<epochwolf>
lewis: google is your friend.
<epochwolf>
lewis: the application is structured in functions, not a series of operations.
<robacarp_>
lewis: did you just set a big-ol-trap o' computer science?
<epochwolf>
lewis: functional languages have a fatal flaw of being extremely difficult to optimize because they completely abstract from the machine.
<banisterfiend>
epochwolf: isn't haskell significantly faster than ruby? iirc
<lewis>
epochwolf: would you consider C to be functional?
<lewis>
banisterfiend: yes
<epochwolf>
lewis: no.
<epochwolf>
banisterfiend: yes.
__class__ has joined #ruby
<banisterfiend>
epochwolf: so the flaw might not be too fatal ;)
<lewis>
robacarp_: lol
sroy2 has joined #ruby
<epochwolf>
banisterfiend: perhaps not for web applications.
<epochwolf>
banisterfiend: the problem with the web space is how well does your language allow you to manage strings.
<epochwolf>
lewis: he's using a bunch of terms without defining them rendering them largely meaningless in context.
nobitanobi has joined #ruby
<epochwolf>
okay, I'm going back to tribble land with my nook.
<lewis>
epochwolf: the term “procedural” refers to a style of programming, and does not really describe a language
<lewis>
actually haskell could be defined as procedural
choi has joined #ruby
<lewis>
epochwolf: in the same way you could write c so that it's functional. the bottom line is that it's arguable
<epochwolf>
lewis: it's a mindset.
<epochwolf>
okay, I'm way too tired to sort this out.
<lewis>
00:53 epochwolf: lewis: the application is structured in functions, not a series of operations. -> wrong
<lewis>
epochwolf: good night :)
<musl>
epochwolf: Pleasant period of rest to all. I must slumber as well.
<epochwolf>
lewis: you are in fact wrong and I do not have to prove it.
Divinite has joined #ruby
<banisterfiend>
lewis: so you'd call ruby a procedural language? or a functional language? or an OOP language?
<lewis>
00:53 robacarp_: lewis: did you just set a big-ol-trap o' computer science? -> yes
* lewis
smiles
<Sou|cutter>
banisterfiend: OO and functional
* epochwolf
hides under a pile of tribbles until the storm passes.
<banisterfiend>
lewis: when someone says 'ruby is oop' they dont just mean it's possible to program in the oop style, but that the language actively promotes and facilitates it in its design.
<lewis>
banisterfiend: OOP...but can be procedural...(I dont know much ruby)
<lewis>
banisterfiend: I agree
<banisterfiend>
lewis: same as even though you CAN program OOP in C, C is not generally considered an OOP language, as the langauge doesn't facilitate/support it
<lewis>
banisterfiend: absolutely
macmartine has joined #ruby
<Sou|cutter>
yes, banisterfiend, you are on a roll
banjara has joined #ruby
<musl>
banisterfiend: It's a rectangles & squares thing. I'd suppose that most if not all OOP laguages can be made to perform procedurally, right?
<epochwolf>
musl: except Java
* musl
considers the command pattern.
<epochwolf>
and it's spawn and clones
<lewis>
anyways guys. talk to you soon
<musl>
I mean it now. To bed with me.
* epochwolf
will stabs musl if he speaks in the next hour
<lewis>
probably when im done with rails,
<lewis>
adios
sohocoke has joined #ruby
nikhil_ has joined #ruby
<banisterfiend>
musl: i think it's cute the way ruby can fake free standing functions/procedures, while still tying them into OOP
wolgo has joined #ruby
<wolgo>
anyone using graphvizr?
<wolgo>
Let me rephrase
<wolgo>
Is anyone that is currently in this room using graphvize
<wolgo>
graphvizr
igotnolegs has joined #ruby
<epochwolf>
Is there anyone currently in this room using rails?
<banisterfiend>
no, thankfully this room is normally an oasis away from the brain damaged rails crowd
nobitanobi has joined #ruby
<banseljaj>
epochwolf: I am, but i'm a noob with rails
rking has joined #ruby
genivf has joined #ruby
nobitanobi has joined #ruby
nobitanobi has joined #ruby
ghvandoorn has joined #ruby
qos has joined #ruby
nobitanobi has joined #ruby
minijupe has joined #ruby
nobitanobi has joined #ruby
sohocoke has joined #ruby
cobragoat has joined #ruby
Akuma has joined #ruby
thams has joined #ruby
rking has joined #ruby
yxhuvud has joined #ruby
nobitanobi has joined #ruby
Advocation has joined #ruby
x0F_ has joined #ruby
nobitanobi has joined #ruby
rubenclopez has joined #ruby
rubenclopez has quit [#ruby]
rippa has joined #ruby
mdw has joined #ruby
Advocation has joined #ruby
Emmanuel_Chanel has joined #ruby
Morkel has joined #ruby
nobitanobi has joined #ruby
nobitanobi has joined #ruby
sohocoke has joined #ruby
snip_it has joined #ruby
<TTilus>
epochwolf: my day-job deals with rails, so yes
Advocation has joined #ruby
<epochwolf>
TTilus: I was trolling. I've used rails for 5 yeras.
dql has joined #ruby
mdw has joined #ruby
nikhil_ has joined #ruby
savage- has joined #ruby
rubenclopez has joined #ruby
lessless has joined #ruby
nullobject has joined #ruby
nullobject has joined #ruby
nikhil_ has joined #ruby
justinmcp has joined #ruby
<lessless>
does ruby still use one thread for multithreading?
<lessless>
or can ruby process be run in a parallel?
<epochwolf>
lessless: MRI still has a GIL is that's what you wanted to know.
<epochwolf>
jRuby has full threading support.
<epochwolf>
not sure what the state of Rubinus is
<lessless>
epochwolf, yeah, that is it, one thread at time
sent-hil has joined #ruby
davidw has joined #ruby
<Boohbah>
lessless: consider process parallelism using MRI
<burgestrand>
banisterfiend: lower right if any, could possibly relate it to message sending
sohocoke has joined #ruby
<banisterfiend>
burgestrand: thanks, got any other ideas for method icons?
mdw has joined #ruby
<burgestrand>
banisterfiend: not really, except one could draw the icons from the perspective of performing actions and sending messages, not sure what that would be though
<banisterfiend>
burgestrand: ah ok, btw did u see the new release show-source can show class/module source now too? :
<banisterfiend>
:P
bluOxigen has joined #ruby
bluOxigen has joined #ruby
eka has joined #ruby
<burgestrand>
banisterfiend: yeah! haven’t used it yet though
<banisterfiend>
burgestrand: ah ok :) np
<burgestrand>
banisterfiend: what do you do for it? you iterate through all the methods and find their respective source?
<banisterfiend>
burgestrand: no
kjellski has joined #ruby
<banisterfiend>
burgestrand: there's a command line switch that you can use to show all monkey patches of a class too (-a). Basically the approach is to look at all source_locations of methods for a given class, and then select the source file with the most hits (i.e most methods defined there) as the 'canonical definition'.
<banisterfiend>
we then just move upwards from the source location of one of the methods in the chosen source file
<banisterfiend>
and look for the start of the class definition
<banisterfiend>
once we find it, we then read back down until we get the whole clss def
<banisterfiend>
and that returns the source for the class def with the most methods defined in it. If you then pass -a, you'll see all class definitions for that class, ordered by most number of methods to least
<Mon_Ouie>
banisterfiend: Maybe you could use an icon that makes you think of "message"?
<Mon_Ouie>
And Thread.list to get all the running threads
<Xylo1>
@gener1c: I dont' have an exception, I have a running process and want to see what each tread is doing.
<Xylo1>
@Mon_Ouie: Nice - do you suggest to trap a system signal and then dump all the threads manually?
<gener1c>
i never stack traced
<Mon_Ouie>
You can do that, sure
<gener1c>
what is it for usually?
<gener1c>
folowwing recursions ?
<Mon_Ouie>
Debugging, knowing what's going on
<gener1c>
following*
<gener1c>
yeah but what kind of debugging though
<Xylo1>
@gener1c guess you have a server which does not respond and consumes 100% CPU. When you have a full strack trace you can see what's going on
<gener1c>
ohhh
maesbn has joined #ruby
d34th4ck3r has joined #ruby
<Xylo1>
or it consumes no CPU but does not respond... in the stack trace then you could for example see that all threads are waiting for your database to respond, so there may be a database problem. When you issue two stack traces in a row you can see if the server state changes.
dql has joined #ruby
<Xylo1>
@Mon_Ouie: I guess the interpreter does not provide such a functionality? I know from the java world that you can send a signal to the VM and it dumps the stacktrace to stdout. No need to implement something in the code.
<i256>
anybody uses tinyrb ? it a safe? no file/io ?
<Mon_Ouie>
I don't know about such a feature in ruby
<Xylo1>
@Mon_Ouie: I also found nothing on google, only the xray gem which exactly does this but on 1.9.3 it only shows the status of the current thread. The problem with iteration over Thread.list is that the threads will change during iteration (at least the current thread changes because you iterate) so you'll never get a consistent state. But I think it's sufficient. Thank yoy Mon_Ouie!
mikeycgto has joined #ruby
mikeycgto has joined #ruby
banisterfiend has joined #ruby
viran has joined #ruby
<banisterfiend>
Mon_Ouie: to study computer science?
<viran>
hey, after installing a 'gem' how do i actually run it ?
<banisterfiend>
Mon_Ouie: not interested in Ghent university?
<Mon_Ouie>
My Dutch probably isn't good enough for that
pdtpatrick has joined #ruby
tomzx has joined #ruby
<Xylo1>
@viran: A gem is more like a library, it provides you with additional functionality, so normally you don't just "run" it. What it does and how to use it depends on the gem
<banisterfiend>
Mon_Ouie: studying computer science, or will you surprise us all and choose something like greek history or architecture? ;)
<viran>
Xylo1: oh, i guess i got stuff mixed up :) im trying to run shelr...
<Mon_Ouie>
Engineering — so actually, I'll have some kind of architecture classes for the first few semesters
<c_schmitz>
I am just trying to install glTail: http://www.fudgie.org/. I am running into an issue and want to install a modified gem - how would I do that?
<cloudgeek>
!GUI
nilg has joined #ruby
bashdy has joined #ruby
alindeman has joined #ruby
eka has joined #ruby
cespare has joined #ruby
Rambozo has joined #ruby
16SAA143S has joined #ruby
telling has joined #ruby
sirdeiu has joined #ruby
antihero has joined #ruby
sjaveed has joined #ruby
iaj has joined #ruby
mtkd has joined #ruby
limed has joined #ruby
ixx has joined #ruby
aetaric has joined #ruby
pingveno has joined #ruby
thorncp has joined #ruby
mahlon has joined #ruby
mitchty has joined #ruby
Jackneill has joined #ruby
mrwalker has joined #ruby
banjara has joined #ruby
kil0byte has joined #ruby
jimeh has joined #ruby
seitensei has joined #ruby
visof has joined #ruby
falena has joined #ruby
nilg has joined #ruby
burgestrand has joined #ruby
d3vic3 has joined #ruby
nemesit has joined #ruby
kil0byte has joined #ruby
mborromeo has joined #ruby
brngardner has joined #ruby
atmosx has joined #ruby
jscoder has joined #ruby
alem0lars has joined #ruby
slonimsky has joined #ruby
schaerli has joined #ruby
madsgraphics has joined #ruby
<jscoder>
I installed a gem but when requiring it, Ruby says it could not be found. $ ruby -v outputs 1.9.2 and $ gem env outputs 1.8.7, so it looks like I installed the gem on a different ruby version. How do I fix that?
<atmosx>
jscoder: my ruby is 1.9.3 and gem is 1.8.11, their versions are not parallel
bawer has joined #ruby
<jscoder>
atmosx: ok. Any idea how to get this to work though? I installed it with sudo gem install gemname
<atmosx>
jscoder: either you don't require it the right way, or you have some issues with your paths. You're using 'sudo' or something to install/remove gem? what os are you on?
<atmosx>
try running your script using 'sudo'
<jscoder>
atmosx: Linux Ubuntu 11.10. I'm requiring it like it said in the documentation
<atmosx>
you don't need require 'rubygems' under 1.9.2
<atmosx>
1.9.x
<atmosx>
remove that
<atmosx>
what's your error?
<jscoder>
<internal:lib/rubygems/custom_require>:29:in `require': no such file to load -- closure-compiler (LoadError) from <internal:lib/rubygems/custom_require>:29:in `require' from /usr/local/bin/minify:16:in `<main>'
<banisterfiend>
anyone here familiar with smalltalk?
SolarisBoy has joined #ruby
<jscoder>
Same result when removing the require 'rubygems'
<atmosx>
because ruby 1.9.x on linux is still tricky for many parts of the system
<atmosx>
so they have 1.8 by default etc
<jscoder>
atmosx: Alright, thanks :) I'll take a look at it later
<atmosx>
okay, cya
<atmosx>
jscoder: another good idea, would be contacting the gem author
iocor has joined #ruby
<atmosx>
or if this gem has a google-group or something, post the error there.
<jscoder>
atmosx: I'll open an issue on the github repo later if it doesn't work with RVM
<banisterfiend>
anyone here familiar with smalltalk?
brngardner has joined #ruby
darthdeu has joined #ruby
sbanwart has joined #ruby
grin has joined #ruby
visof has joined #ruby
shiroginne has joined #ruby
<shiroginne>
дня всем
bawer has joined #ruby
atmosx has joined #ruby
LLama has joined #ruby
kish_ has joined #ruby
Asher1 has joined #ruby
fbernier has joined #ruby
cinaski_ has joined #ruby
preller_ has joined #ruby
jshsu_1 has joined #ruby
Nss has joined #ruby
lessless has joined #ruby
kish has joined #ruby
kirun has joined #ruby
vjacob has joined #ruby
S1kx has joined #ruby
S1kx has joined #ruby
Vert has joined #ruby
justinmcp has joined #ruby
kish has joined #ruby
banjara has joined #ruby
smoo has joined #ruby
kil0byte has joined #ruby
kish has joined #ruby
lucasefe has joined #ruby
visof has joined #ruby
kish has joined #ruby
schaerli has joined #ruby
Mattias has joined #ruby
kish has joined #ruby
emmanuelux has joined #ruby
brngardner has joined #ruby
<Mattias>
I'm trying to do gem install bdb, but I get this error: http://pastebin.com/TQmaJUMp I have berkeley db 5.3.15 installed Anyone knows what could be wrong? I need this for another gem -.-
<Mattias>
or is the gem just outdated? O.o
agilobable has joined #ruby
kish has joined #ruby
<Mattias>
nvm, seems there was a package ruby-bdb in aur, this version works fine.
banisterfiend has joined #ruby
king313 has joined #ruby
Indian has joined #ruby
kish has joined #ruby
tvw has joined #ruby
waxjar has joined #ruby
atmosx has joined #ruby
thecreators has joined #ruby
schaerli has joined #ruby
kish has joined #ruby
macmartine has joined #ruby
kil0byte has joined #ruby
kish has joined #ruby
kil0byte has joined #ruby
kish has joined #ruby
Shoobdidoo has joined #ruby
kish has joined #ruby
Mattias has quit ["WeeChat 0.3.7"]
kish has joined #ruby
Jakee` has joined #ruby
kil0byte_ has joined #ruby
davidpk has joined #ruby
WhereIsMySpoon has joined #ruby
WhereIsMySpoon has quit ["Leaving"]
kish has joined #ruby
shruggar has quit [#ruby]
S2kx has joined #ruby
bbttxu has joined #ruby
polishguy94 has joined #ruby
kish has joined #ruby
S3kx has joined #ruby
tommyvyo has joined #ruby
bluenemo has joined #ruby
bluenemo has joined #ruby
fbernier has joined #ruby
kil0byte has joined #ruby
shruggar has joined #ruby
kish has joined #ruby
williamcotton has joined #ruby
SPYGAME has joined #ruby
kil0byte_ has joined #ruby
banjara has joined #ruby
apeiros_ has joined #ruby
windzping has joined #ruby
kish has joined #ruby
darthdeus has joined #ruby
davidpk has joined #ruby
td123 has joined #ruby
dustybrains has joined #ruby
Targen has joined #ruby
kish has joined #ruby
voodoofish has joined #ruby
kil0byte has joined #ruby
banjara1 has joined #ruby
Sailias has joined #ruby
thone has joined #ruby
andrewhl has joined #ruby
kish has joined #ruby
kil0byte has joined #ruby
lkba has joined #ruby
<jscoder>
atmosx: Still there? I installed rvm, what should I do now? :)
yeggeps has joined #ruby
kish has joined #ruby
nilg has joined #ruby
<polishguy94>
Does thin webserver reacts to changes in code automatically or after restart?
atmosx has joined #ruby
ctp has joined #ruby
<ctp>
Hi folks. I have an array of hashes and want to get the first element of the sorted array but with an additional constraint: it should be :locked => false
<apeiros_>
alternatively you could use min_by and have locked ones return Float::INFINITY instead of the ratio
williamcotton has joined #ruby
<ctp>
ah, ok
<apeiros_>
if you only sort to get the first unlocked one, then I'd use that approach instead. better performance.
<ctp>
good point
<apeiros_>
(sort is O(nlogn), min is O(n))
<ctp>
ok, cool
<ctp>
thx
williamcotton has joined #ruby
kish has joined #ruby
<ctp>
apeiros_: argh, i need the er_ratio as value for statistics purposes
<apeiros_>
ctp: and? you get the whole hash back…
chomp has joined #ruby
<kallisti>
banisterfiend: hello
<ctp>
"and have locked ones return Float::INFINITY instead of the ratio" -> i need :er_ratio = realvalue instead of :er_ratio = Float::INFINITY That;s what you meant, right?
kish has joined #ruby
<apeiros_>
ctp: you should *probably* read the docs of min_by
<ctp>
ok, i'll do :)
<apeiros_>
min_by er_ratio, means you return the er_ratio from the block. that does NOT mean that min_by returns only the er_ratio
<agilobable>
tadzik: to znaczy ze coś dobrze schował :D
<agilobable>
sry wrong tab.
<apeiros_>
and for locked ones, you return Float::INFINITY instead of the er_ratio, so min_by will not consider them as the minimum
<ctp>
ah, ok. i understand
<apeiros_>
gotta go
carlyle has joined #ruby
kish has joined #ruby
pencilcheck has joined #ruby
bluenemo has joined #ruby
bluenemo has joined #ruby
sbanwart has joined #ruby
nilg has joined #ruby
kish has joined #ruby
xoebus has joined #ruby
fbernier has joined #ruby
sbanwart_ has joined #ruby
kish has joined #ruby
xcvd has joined #ruby
nif has joined #ruby
visof has joined #ruby
kish has joined #ruby
jbw has joined #ruby
ken_barber has joined #ruby
nilg has joined #ruby
conor_ireland has joined #ruby
headius has joined #ruby
kish has joined #ruby
Kyle__ has joined #ruby
<kallisti>
so I push arrays onto an array like this
<kallisti>
arr << [a,b]
<kallisti>
later on
<kallisti>
shouldn't this work?
<kallisti>
a, b = arr.pop
nif has joined #ruby
<niklasb>
kallisti: yes, it should
<shevy>
are you still not using irb man :(
<shevy>
array = []; array << [1,2] # => [[1, 2]]
<kallisti>
shevy: I am
<kallisti>
I'm debugging a program
<shevy>
you'll have an array in an array if you append an array
<kallisti>
the problem is unrelated to what I thought it was.
<kallisti>
I was just double checking that some other craziness wasn't happening
Russell^^ has joined #ruby
dql has joined #ruby
nif has joined #ruby
<shevy>
I would be wary when you do operations like pop
yoklov has joined #ruby
<shevy>
I've seen people use things like foo.chomp!.map {} and then be confused why things did not work
kish has joined #ruby
<kallisti>
shevy: well since I'm writing a stack machine.. I'm not. :P
* kallisti
is only a noob at Ruby, not programming. :P
heldopslippers has joined #ruby
timonv has joined #ruby
bglusman has joined #ruby
tomzx has joined #ruby
kish has joined #ruby
williamcotton has joined #ruby
johnmilton has joined #ruby
kish has joined #ruby
Platz has joined #ruby
mattyoho has joined #ruby
thams has joined #ruby
kish has joined #ruby
Clordio has joined #ruby
iocor has joined #ruby
btaitelb has joined #ruby
minijupe has joined #ruby
kish has joined #ruby
schaerli has joined #ruby
lateau has joined #ruby
kish has joined #ruby
nilg has joined #ruby
headius has joined #ruby
kish has joined #ruby
SegFaultAX|work has joined #ruby
seanstickle has joined #ruby
king313 has joined #ruby
kish has joined #ruby
elake has joined #ruby
Platz has quit [#ruby]
kil0byte has joined #ruby
mpereira has joined #ruby
zhangkaizhao has joined #ruby
kish has joined #ruby
mengu has joined #ruby
tommyvyo has joined #ruby
kish has joined #ruby
KL-7 has joined #ruby
brngardner has joined #ruby
cooler has joined #ruby
SegFaultAX has joined #ruby
kish has joined #ruby
ianbrandt has joined #ruby
Eldariof-ru has joined #ruby
Drewch has joined #ruby
zakwilson has joined #ruby
mborromeo has joined #ruby
wookiehangover has joined #ruby
ghvandoorn has joined #ruby
polishguy94 has joined #ruby
dkissell has joined #ruby
dbgster has joined #ruby
looopy has joined #ruby
<kallisti>
so if you pass a string as the first argument of gsub, it's not treated as regex right?
<kallisti>
it seems to be doing strange things with hyphens
uris has joined #ruby
Targen has joined #ruby
machine1 has joined #ruby
<ctp>
Howdy. Anyone here can take a look at this simple Ruby snippet: https://gist.github.com/2438158 ? How to get this array sorted?
headius has joined #ruby
pdtpatr1ck has joined #ruby
zakwilson has joined #ruby
Mohan has joined #ruby
Mohan has joined #ruby
jgrevich has joined #ruby
jgrevich has joined #ruby
zakwilson_ has joined #ruby
alindeman has joined #ruby
strife25 has joined #ruby
CheeToS has joined #ruby
<Tasser>
ctp, consider using structs
tommyvyo has joined #ruby
<Tasser>
ctp, and switch the order of ratio/request
<ctp>
what I am looking for is sorted by er_ratio and in cases where er_ratio is the same additionally sorted by requests in reverse order
<ctp>
so the higher request rate should appear before the lower in cases where er_ratio is same
headius has joined #ruby
<ctp>
and all as performant as possible :)
rippa has joined #ruby
nooga has joined #ruby
<nooga>
hi
brngardner has joined #ruby
<nooga>
i'm trying to roll my own gem for use with rails and have a problem with finding paths to the gem's own files (like templates or precalculated data)
<polishguy94>
What tool to AJAXify post requests in sinatra?
<nooga>
how should I refer to the gem's files?
dkissell has joined #ruby
Sailias has joined #ruby
headius has joined #ruby
savage- has joined #ruby
Cache_Money has joined #ruby
savage- has joined #ruby
sonkei has joined #ruby
Drewch has joined #ruby
maletor has joined #ruby
andrewhl has joined #ruby
rubenclopez has joined #ruby
keymone has joined #ruby
ananthakumaran has joined #ruby
mikeycgto has joined #ruby
mikeycgto has joined #ruby
rushed has joined #ruby
dql has joined #ruby
scb has joined #ruby
waxjar has joined #ruby
eph3meral has joined #ruby
berserkr has joined #ruby
jjore has joined #ruby
elspeth has joined #ruby
jsaak has joined #ruby
<elspeth>
am i going blind, or does the vim-ruby gem not exist anymore?
<eph3meral>
elspeth, vim isn't supposed to be user friendly :P
<elspeth>
eph3meral: eh, i find it user-friendly enough, although that says more about me than about vim, perhaps.
<eph3meral>
my only gripe is that ruby syntax hiliting borks when you use marker folds
<eph3meral>
really pretty annoying, and doesn't quite make sense to me
<ca_bud>
e.g. convert http/domain.com/something/anotherthing/page.html to "34fd" or something similar. is there a text compression or checksum thing that ruby has that I can use?
looopy has joined #ruby
<elspeth>
i'm currently interested in all this because i'm getting back into ruby/rails dev after a mutli-year lapse
<eph3meral>
elspeth, meh, I say just use vim as it stands... I don't find myself wanting for much
<eph3meral>
elspeth, it sounds like you'd be more at home with an IDE
<eph3meral>
most people who want an IDE just don't know how to make good use of a powerful text editor :P
<eph3meral>
elspeth, I mean, not exactly "as it stands" but... all you really need is NERDTree and Command-T as far as plugins and you'll be fine
<eph3meral>
elspeth, maybe yankring and matchit, but none of those are ruby specific... well, except that Command-T is written in ruby :)
mborromeo has joined #ruby
<elspeth>
i just want decent autocomplete, really.
<eph3meral>
elspeth, which vim already has
<eph3meral>
elspeth, no need for plugins
<elspeth>
eh, it's so-so for rails, or has been in the past
<eph3meral>
o.0
<eph3meral>
elspeth, you're not even in #vim btw
<elspeth>
i know.
<eph3meral>
seems a far better forum than this
kil0byte has joined #ruby
* elspeth
shrug; i originally was asking about a rubygem, so.
<eph3meral>
lol, a vim rubygem
<eph3meral>
which is just, odd, to say the least
<eph3meral>
I can see why it was removed
<elspeth>
it happens to be one mentioned in a lot of places.
<eph3meral>
the theory that many people can't be wrong is a bad one
<elspeth>
well, many people can have something i want to look at, even if it turns out that i point and giggle at the lemmings.
<eph3meral>
elspeth, I'm trying to save you the time of looking at something that's not worth the time :P
<eph3meral>
but anyway, seek as you will
<eph3meral>
elspeth, you should /join #vim
niklasb_ has joined #ruby
<elspeth>
yes, probably.
<elspeth>
usually i just ask my husband if i've got a q, but he's snoring atm
<kallisti>
eph3meral: that kind of defeats the purpose
<shevy>
%w( a b c ).map(&:capitalize) # => ["A", "B", "C"]
<kallisti>
shevy: Ruby 1.9 yes?
<shevy>
works on 1.8.x too
<eph3meral>
i don't believe you can do puts like that
<eph3meral>
other methods, sure
<eph3meral>
but not puts, afaik
lolmaus has joined #ruby
<kallisti>
what's different about puts?
<shevy>
yeah, not sure it works with puts. puts invokes #to_s or? perhaps you have to pass to_s
<lolmaus>
How do i unit-test private methods?
<agilobable>
shevy: it looks so perl :P
<shevy>
agilobable yeah it is ugly
<shevy>
I find lambda ugly too though :P
<eph3meral>
lolmaus, you don't, you unit test the public ones that use them
<kallisti>
the point is to avoid lambdas and blocks
<eph3meral>
shevy, yeah we know you have a difficult time reading ruby code
<kallisti>
and just pass the method directly
<shevy>
lol
<shevy>
eph3meral the shit you write and call "ruby code" indeed :)
banisterfiend has joined #ruby
<lolmaus>
eph3meral, it kinda ruins my understanding of TDD
<eph3meral>
shevy, yes we know you have a hard time understanding ruby code
<shevy>
eph3meral you should learn ruby properly one day
<shevy>
not use eval all the time for one
<shevy>
that's your take home message for today
<kallisti>
arr.each(&:puts) # why wouldn't this work?
<eph3meral>
shevy, go drink your juice box and play with your barbies
<eph3meral>
kalleth, 1.puts doesn't work
<eph3meral>
that's why
tomb| has joined #ruby
<eph3meral>
kallisti,
<shevy>
eph3meral only if you stop using ruby :)
<eph3meral>
yep, like I thought... time for /ignore
<shevy>
no please
<shevy>
don't ignore me :(
<rippa>
kallisti: arr.each(&method(:puts))
<kallisti>
meh...
<kallisti>
so much extra typing to do the "simpler" case.
<eph3meral>
kalleth, not if you use a lambda
<shevy>
lol
<eph3meral>
&putme is about as much typing as &:puts
<shevy>
it is kallisti not kalleth
<kallisti>
that's not the point
<kallisti>
of course I can just define lambdas off to the side
<Mon_Ouie>
Why so much hate for blocks?
<lolmaus>
eph3meral, i've googled up a quick solution: myobject.send(:method_name, args)
<kallisti>
I can just define methods off to the side
<kallisti>
I can just use blocks.
Guest2767 has joined #ruby
<Mon_Ouie>
ary.each { |o| puts o } is just fine
<kallisti>
the point is to avoid blocks, and pass an existing named method
<kallisti>
yeah that's fine
<Mon_Ouie>
(Although in that example puts ary is shorter)
<kallisti>
it's just... not how I would have it. :P
<eph3meral>
kallisti, which, essentially you have... if you use a lambda
<eph3meral>
an existing named method exists after you define it with a lambda
<kallisti>
eph3meral: I don't think you understand what I mean.
tewecske has joined #ruby
<eph3meral>
kallisti, no i understand perfectly, i just think you're being obtuse like shevy
<kallisti>
think what you like.
<eph3meral>
if you're gonna reuse that block numerous times anyway then it's more DRY
<TTilus>
uhh, whats going on here?
<kallisti>
I'm not.
<eph3meral>
kalleth, then a block is more appropriate, not everything in code will be perfect and beautiful
<shevy>
it is a known fact that eph3meral is not only clueless when it comes to ruby but also he is an idiot
<eph3meral>
sometimes you have to know how to just deal with it and move on
<shevy>
and he fails at tab completion too
<kallisti>
eph3meral: yeah that's fine.
<kallisti>
I was just hoping for a better way
<eph3meral>
kalleth, not for puts
<eph3meral>
IMO you shouldn't be using puts anyway
<shevy>
please someone kill the eph3meral troll
<eph3meral>
kalleth, puts arr.join("\n") or similar would be more "beautiful"
<shevy>
...
<kallisti>
in Haskell for example: (\x -> f x), which is a lambda, is completely and utterly equivalent to f in all situations, everywhere.
<eph3meral>
kalleth, if you're literally ONLY using puts, then there are more elegant ways to do that anyway without even using a loop in the first place
<eph3meral>
i know some haskell
<kallisti>
eph3meral: well it's actually a File not an Array
<eph3meral>
i'm trying to be accomodating of your your idiocy, perhaps I should just keep being a total ass?
<shevy>
see?
<eph3meral>
there is one that'll return the lines as an array
<eph3meral>
forget which one
<shevy>
that's the only thing he can do
<TTilus>
shevy: everybody needs to find it out by themselves
<kallisti>
eph3meral: I haven't been disrespectful this entire conversation. But I see there's no point in continuing
<shevy>
yeah TTilus :(
<kallisti>
good day.
kallisti has quit [#ruby]
<TTilus>
shevy: ...trollnes i mean
<Mon_Ouie>
It returns an Enumerator (which happens to be the similar to Haskell's lazy lists, actually)
<TTilus>
shevy: at least i _want_ to find it out by myself
<Mon_Ouie>
There's IO#readlines
<eph3meral>
yeah readlines I believe is what I was thinking of
<eph3meral>
TTilus, possibly puts arr.inspect
<shevy>
...
<eph3meral>
of course, we really have no idea what he is even trying to do
<TTilus>
eph3meral: ?
<shevy>
I think he randomly chains together some methods :)
<eph3meral>
apparently he just wants to read a file and dump it on STDOUT
<eph3meral>
how useful
<shevy>
god eph3meral you are so dumb
<TTilus>
eph3meral: but it _is_ ;)
<eph3meral>
TTilus, i only suggested .join("\n") cuz I have no idea what kind of formatting he wants, it would seem that a naturally inquisitive and minorly intelligent person might be able to grok some other type of line delimiter for themselves
<eph3meral>
was trying to give him the benefit of the doubt
<TTilus>
eph3meral: if it would not be, why is cat ubiquitous? =D
<eph3meral>
TTilus, indeed :)
<eph3meral>
the only problem being... cat is ubiquitous
<eph3meral>
actually, does cmd.exe have cat?
<TTilus>
eph3meral: puts arr is equivalent to puts arr.join("\n")
<eph3meral>
well, that's not quite the right phrasing
<eph3meral>
TTilus, yes I'm aware, see my above comment about trying to give him the benefit of the doubt
<TTilus>
ok
<Mon_Ouie>
Actually, it's not really
<Mon_Ouie>
ary.join("\n") will create a string with two new-lines in a row in this case
<TTilus>
Mon_Ouie: ok, _essentially_ the me same
<TTilus>
s/me //
<Mon_Ouie>
It does mean ary.join("\n") isn't the content of the file
<TTilus>
thats true
<TTilus>
with io.readlines.join("\n") aint idempotent
<TTilus>
then something totally different
tomp has joined #ruby
ringotwo has joined #ruby
<TTilus>
ive got this graphical dsl, which is used to draw dull stuff like business processes, which are then used to generate ruby code
<TTilus>
on top of that we sometimes need to resort to plain old programming
<TTilus>
currently we just manyally reopen and monkey-patch classes
<TTilus>
any ideas how to do that differently?
<TTilus>
it works fine as it is
<TTilus>
the only downside is that require 'module_name/class_name' convention does not work
<TTilus>
because there are several files per class on loadpath and we (of course) need them all, not just the first of them
Sailias has joined #ruby
tomb has joined #ruby
schaerli_ has joined #ruby
gmci has joined #ruby
tommyvyo has joined #ruby
sn0rri has joined #ruby
IPGlider has joined #ruby
ananthakumaran has joined #ruby
includex has joined #ruby
ctwiz has joined #ruby
mdw has joined #ruby
ananthakumaran has joined #ruby
meskyanichi has joined #ruby
ringotwo has joined #ruby
Minimalist has joined #ruby
strife25 has joined #ruby
kah_ has joined #ruby
Mohan has joined #ruby
Mohan has joined #ruby
chico has joined #ruby
yellow5 has joined #ruby
sharms has joined #ruby
madsgraphics has joined #ruby
jarred has joined #ruby
keymone has quit [#ruby]
S1kx has joined #ruby
S1kx has joined #ruby
zakwilson has joined #ruby
stephenjudkins has joined #ruby
ananthakumaran has joined #ruby
ctp_ has joined #ruby
tayy has joined #ruby
Drewch has joined #ruby
symb0l has joined #ruby
banjara has joined #ruby
Bosma has joined #ruby
johnduhart has joined #ruby
c_schmitz has quit ["I'm a happy Miranda IM user! Get it here: http://miranda-im.org"]
S2kx has joined #ruby
schovi has joined #ruby
chomp has joined #ruby
andrewhl has joined #ruby
francisfish has joined #ruby
savage- has joined #ruby
ghvandoorn has joined #ruby
andrewhl has joined #ruby
iboB has joined #ruby
tewecske has joined #ruby
iboB has quit [#ruby]
tomzx has joined #ruby
platzhirsch1 has joined #ruby
iboB has joined #ruby
brianpWins has joined #ruby
schovi has joined #ruby
<iboB>
this may be windows specific but i have no other os to test it: `some commands` works fine when the commands print to stdout, but when they print to stderr it returns nothing and instead i see the stderr output in my console
<iboB>
is this normal, and if yes, how can i catch stderr, too?
apeiros_ has joined #ruby
andrewhl has joined #ruby
apeiros_ has joined #ruby
<iboB>
nevermind... i eventyally found out
looopy has joined #ruby
russianmob has joined #ruby
<russianmob>
Data Mapper doesn't return false in my if statements with Class.create(params) when the data is not valid
heldopslippers has joined #ruby
francisfish has joined #ruby
<iboB>
so system returns the process return number and `` gets me the stdoutput. Can I have both?
rubenclopez has quit [#ruby]
<Mon_Ouie>
You can use $? to get the status code
<shadoi>
iboB: you probably want something more like popen3 and/or shell
<shadoi>
both in stdlib
S1kx has joined #ruby
S1kx has joined #ruby
philcrissman_ has joined #ruby
andrewhl has joined #ruby
nkts has joined #ruby
jarjar_prime has joined #ruby
tayy has joined #ruby
harukomoto has joined #ruby
benDos has joined #ruby
<benDos>
I'm buiilding ruby for the first time, after a bunch of cc calls it seems to have stopped honoring the -j 32 I passed make
<benDos>
Seems to be using only one thread to compile now
<benDos>
Is that a problem with something I should have passed ./configure?
max_ has joined #ruby
stephenjudkins has joined #ruby
TheIronWolf has joined #ruby
doug11 has quit [#ruby]
zakwilson has joined #ruby
brianpWins_ has joined #ruby
asteros has joined #ruby
<Mon_Ouie>
Could just be related to dependencies making it impossible to go on until some task is completed
davidw has joined #ruby
scb has joined #ruby
andrewhl has joined #ruby
asteros has quit [#ruby]
sam113101 has joined #ruby
philcrissman_ has joined #ruby
workmad3 has joined #ruby
madsgraphics has joined #ruby
S1kx has joined #ruby
S1kx has joined #ruby
ctp has joined #ruby
stephenjudkins has joined #ruby
ctp_ has joined #ruby
<benDos>
Mon_Ouie, yeah but it doesn't fall back to a single thread until it starts executing ruby
<benDos>
all the compiling directly invoked by make does the right thing
philcrissman_ has joined #ruby
s0ber has joined #ruby
alem0lars has joined #ruby
tewecske has joined #ruby
philcrissman_ has joined #ruby
<Mon_Ouie>
Well, -j 32 means make will execute 32 tasks at the same time. If one of those tasks call gcc more than once, it won't parallelize it
d3c has joined #ruby
<benDos>
Yeah.. hmm alright thanks anyway
andrewhl has joined #ruby
michaelmartinez has joined #ruby
<iboB>
shadoi, actually i wanted $?.exitstatus
pdtpatr1ck has joined #ruby
<agilobable>
how do i make a range with step without using loops or step method like => (1..100).step(2) ?
stephenjudkins has joined #ruby
<apeiros_>
agilobable: why the restriction?
<apeiros_>
why not use step?
<agilobable>
i wanted to write it in one line
mdw has joined #ruby
<agilobable>
step(){|x| puts x} is 3lines at least
<apeiros_>
and you can't write it in 1 line with step???
<apeiros_>
errr… you just wrote your alleged 3 lines in one line
<agilobable>
i can but it looks perlish
<apeiros_>
oh my
<DefV>
but.. why
<apeiros_>
I don't think I can help with that. I don't think I even want to.
<DefV>
agilobable: show me what you want to do in another language in 1 line then :-)
asteros has joined #ruby
<apeiros_>
DefV: pythons list comprehensions probably don't look perlish…
<agilobable>
DefV: range(min, max, step) < python
<apeiros_>
agilobable: that doesn't do anything more than (min..max).step(step) either.
<apeiros_>
so, um, bullshit?
<agilobable>
it does a single array with numbers
<apeiros_>
(min..max).step(step).to_a
thecreators has joined #ruby
<agilobable>
apeiros_: cheers! :)
<DefV>
but that's worse!
<agilobable>
accutaly it's quite good ;)
<apeiros_>
also see Array.new (needs elementary school math knowledge, though!!!)
<Mon_Ouie>
The Python REPL doesn't seem to think it's an array
adamkittelson has joined #ruby
<DefV>
the beauty of a range is that it doesn't instantiate every damn item
<Mon_Ouie>
type(range(0, 10, 2)) is <class 'range'>, not list
<DefV>
if you do .step(2) on it it creates an iterator ready to iterate
<DefV>
if you do .to_a it actually takes all possible values and stores them in memory for your enjoyment
<shevy>
The Python REPL must die
chris_mh has joined #ruby
<shevy>
rather than allow me to exit it it tells me to append () !!!
<DefV>
(1..999999999999).step(2) = cheap, (1..999999999999).step(2).to_a = still running on my machine
<apeiros_>
DefV: that just proves that ruby is slow!!!!!!!11elf
<DefV>
troll :-p
<apeiros_>
:)
<apeiros_>
was it that obvious?
<chris_mh>
hey. I'm attempting to get ruby and python to interact nicely (I'm writing the python end), and I'd like to use some sort of IPC between them. I'm not familiar with ruby, but I'd like to do something that the guy writing the ruby end will not have to jump through hoops to use; any suggestions on a kind of IPC that will work nicely?
<apeiros_>
chris_mh: I think json and yaml are both implemented on both platforms
<apeiros_>
anything IO is relatively simple in ruby, so that part shouldn't be difficult.
<chris_mh>
is json built-in in ruby?
<apeiros_>
yes
<DefV>
yes?
<apeiros_>
yes. sometime in 1.9's lifecycle it became stdlib
<chris_mh>
hm, okay. I wondered because I google "json in ruby" and it brought up an external lib
<chris_mh>
googled*
<apeiros_>
chris_mh: well, installing a gem isn't considered a hoop in ruby, I'd say.
<apeiros_>
but as said, in 1.9, it's part of stdlib. not sure whether already in 1.9.2, or only as of 1.9.3
<chris_mh>
that's good to know. I'm always cautious of adding dependencies when writing code for other people
<apeiros_>
yaml has been part of stdlib for a longer time, though. it also supports a far wider range of basic datatypes
<apeiros_>
dates for examples. or integer. or binary data.
<chris_mh>
oh, hm, okay.
iboB has quit [#ruby]
<chris_mh>
yaml isn't shipped with python yet, but I do like it quite a bit. seems a bit of an odd fit for IPC, though
rexbutler has joined #ruby
<apeiros_>
well, there are other serialization formats
<apeiros_>
just pick one that exists as a mature lib for python and ruby.
<chris_mh>
json seems a good choice, I'll run it by him first. thanks!
bluOxigen has joined #ruby
shruggar has joined #ruby
nif has joined #ruby
Akuma has joined #ruby
khakimov has joined #ruby
quest88 has joined #ruby
ctp has joined #ruby
ctp- has joined #ruby
daidoji has joined #ruby
andrewhl has joined #ruby
<agilobable>
0.step(100, 2).to_a # => thats looks like good ruby code ;)
harukomoto has joined #ruby
centr0 has joined #ruby
zakwilson has joined #ruby
emmanuelux has joined #ruby
igotnolegs has joined #ruby
rckts has joined #ruby
rckts has joined #ruby
johnste has joined #ruby
<apeiros_>
depending on how it is used, it looks like inefficient ruby code
<apeiros_>
but DefV already explained that
madsgraphics has joined #ruby
manners has joined #ruby
kjellski has joined #ruby
philcrissman_ has joined #ruby
andremaha has joined #ruby
iocor has joined #ruby
rckts has joined #ruby
sbanwart has joined #ruby
tommyvyo has joined #ruby
davidpk has joined #ruby
brianpWins_ has joined #ruby
ViperMaul has joined #ruby
Freelancer has joined #ruby
Azure|netbook|dc has joined #ruby
tommyvyo has joined #ruby
ckrailo has joined #ruby
c0rn has joined #ruby
zakwilson has joined #ruby
pubis has joined #ruby
sroy2 has quit [#ruby]
mpereira_ has joined #ruby
mikos has joined #ruby
Freelancer has joined #ruby
snip_it has joined #ruby
ryan_dev70 has joined #ruby
Freelancer has joined #ruby
grin has joined #ruby
philcrissman_ has joined #ruby
dave_ has joined #ruby
andrewhl has joined #ruby
garyDemilo has joined #ruby
savage- has joined #ruby
neersighted has joined #ruby
emmanuelux has joined #ruby
workmad3 has joined #ruby
llaskin has joined #ruby
brianpWins has joined #ruby
chimkan_ has joined #ruby
dwon has joined #ruby
philcrissman_ has joined #ruby
kallisti has joined #ruby
berserkr has joined #ruby
futurechimp has joined #ruby
burgestrand has joined #ruby
sebastian_pl has joined #ruby
pygmael has joined #ruby
brianpWins has joined #ruby
krusty_ar has joined #ruby
mrwalker has joined #ruby
francisfish has joined #ruby
brianpWins_ has joined #ruby
<pygmael>
is there a philosophical consensus on using classes for namespacing?
c_rl has joined #ruby
KL-7 has joined #ruby
<burgestrand>
pygmael: yes, do it, especially in libraries
<pygmael>
so like if I've got a User class, having a User::Picture class or something or something is not bad business?
c_rl has quit [#ruby]
Araxia_ has joined #ruby
pygmael has joined #ruby
snip_it has joined #ruby
philcrissman_ has joined #ruby
c0rn has joined #ruby
snip_it has joined #ruby
Jake232 has joined #ruby
<shevy>
something or something
<shevy>
pygmael one reason people often use a class for namespace is because they can then call #new
brianpWins_ has joined #ruby
<shevy>
class Foo; class Bar ... Foo.new
eka has joined #ruby
<pygmael>
yeah
<pygmael>
seems like the alternative
harukomoto has joined #ruby
<pygmael>
would be to make User a module and make User::Base the class instead
<pygmael>
or something :)
Sailias has joined #ruby
<pygmael>
since namespacing is typically done with Modules, I thought there might be some gotchas if you do it with classes instead. Only one I can think of is if that someone else tries to reopen it as a module there will be a conflict
<garyDemilo>
Are symbols like :example useful for anything besides being an immutable string holder?
<shevy>
yeah pygmael but I think that is a flaw in the design of ruby
<shevy>
I don't think the user need to know that you extend a module or a class
<shevy>
extend Name
<shevy>
should suffice
brianpWins_ has joined #ruby
<shevy>
garyDemilo, in hashes they may be more efficient than string objects, as keys
seanstickle has joined #ruby
<garyDemilo>
shevy: so that's it? a more efficient string?
<shevy>
it is not a string
<garyDemilo>
right, but that's it's best use?
<garyDemilo>
*its
<shevy>
I suppose so
<shevy>
they dont seem that useful altogether
<pygmael>
shevy I thought that smelled weird, thanks for the confirmation
<garyDemilo>
shevy: hm. Ok, thanks for the info.
philcrissman_ has joined #ruby
ghvandoorn has joined #ruby
xcvd` has joined #ruby
xcvd` has joined #ruby
brianpWins_ has joined #ruby
freeayu has joined #ruby
mikeycgto has joined #ruby
mikeycgto has joined #ruby
workmad3_ has joined #ruby
slonimsky has joined #ruby
waxjar has joined #ruby
Xylo has joined #ruby
v4n_ has joined #ruby
conor_ireland has joined #ruby
kjellski_ has joined #ruby
moshee has joined #ruby
davidpk has joined #ruby
eka has joined #ruby
kish has joined #ruby
td123 has joined #ruby
zakwilson has joined #ruby
PsiliPharm has joined #ruby
kemet has joined #ruby
Ttech2 has joined #ruby
banisterfiend has joined #ruby
zakwilson has joined #ruby
<icy`>
hi, i'm having trouble substituting in a "\" (backslash) . trying to convert ' into \' . str.gsub("'","\'") fails, as does more than one backslash
<alindeman>
icy`: What do you mean by fails?
<icy`>
in irb
philcrissman_ has joined #ruby
<icy`>
str = "Director's"
youdonotexist has joined #ruby
<alindeman>
icy`: ?
<icy`>
alindeman, ?
<alindeman>
I still don't understand what you mean
<icy`>
turn the string into "Director\'s"
<alindeman>
Ah, I get it know. Unfortunately \` means something special to gsub
<alindeman>
You need do something like str.gsub("'", "\\\\'")
<icy`>
ah, ok, ty =)
chico` has joined #ruby
<icy`>
i ended up changing it to '' , as i think that's another way to escape ' for my purposes
<shadoi>
ichilton: \' is a special variable to anything involving regexes, it means "post-match"
<icy`>
correction: i gsub'd to \\\\' in one place, and '' in another