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
burns180 has joined #ruby
bwlang has joined #ruby
Clordio_ has joined #ruby
SphericalCow has joined #ruby
SphericalCow has joined #ruby
swarley has joined #ruby
<sam113101> how do I set cookies before getting something with Net::HTTP::get or get_response
<sam113101> I can't find anything
seanstickle has joined #ruby
<swarley> hai
<swarley> i think im going to fork rdoc
<seanstickle> YARD did that I think
<swarley> i want to make it so you can do something like
<swarley> RDoc.description('Array#split', "hlahlahhajldasjbsd")
<swarley> or something
<swarley> and it will change the main text under the header
<swarley> idk
<swarley> maybe, maybe not
jcromartie has joined #ruby
bogwonch has joined #ruby
nikhgupta1 has joined #ruby
keymone has joined #ruby
ZachBeta_ has joined #ruby
shevy2 has joined #ruby
shadoi has joined #ruby
batmanian has joined #ruby
Soliah has joined #ruby
denysonique has joined #ruby
ZachBeta has joined #ruby
welterde has joined #ruby
CheeToS has joined #ruby
frishi has joined #ruby
Guedes has joined #ruby
Behi has joined #ruby
<swarley> banisterfiend, anymore ideas as to what i should to now? :p
rohit has joined #ruby
Behi has joined #ruby
burns180_ has joined #ruby
Behi has joined #ruby
Beoran__ has joined #ruby
wroathe has joined #ruby
ben_alman has joined #ruby
fixl has joined #ruby
zigidias has joined #ruby
tommyvyo has joined #ruby
ZachBeta has joined #ruby
bugtranscriber has joined #ruby
brugtranscriber has quit [#ruby]
Cache_Money has joined #ruby
<otters> does ruby have a lib for mouse control in OSX
philips has joined #ruby
stephenjudkins has joined #ruby
iamjarvo has joined #ruby
scholar01 has joined #ruby
<scholar01> I'm a bit annoyed at building rubygems right now. I was using Jeweler with great success until recently, when I started running into all sorts of conflicts with rake and ruby versions. So, what should I be using to package gems, interface with github, and test my modules?
Azure has joined #ruby
banisterfiend has joined #ruby
liluo has joined #ruby
rohit__ has joined #ruby
rohit__ has quit [#ruby]
Azure has joined #ruby
Azure|dc has joined #ruby
fmcgeough_ has joined #ruby
ank_ has joined #ruby
_null has joined #ruby
dv310p3r has joined #ruby
stephenjudkins_ has joined #ruby
<sam113101> is there an equivalent of http_build_query for ruby?
<pyreal> scholar01: bundler
<pyreal> i'll get you a link to a great series that takes you through it all
Indian has joined #ruby
Behi has joined #ruby
ZachBeta has joined #ruby
linoj has joined #ruby
delinquentme has joined #ruby
jrhorn424 has joined #ruby
mikeric has joined #ruby
looopy has joined #ruby
<scholar01> thanks pyreal
burns180 has joined #ruby
Zolrath has joined #ruby
<Zolrath> ls
<pyreal> scholar01: np.. i followed almost exactly the same steps writing my first gem lasts weekend.. only discovered the article after i had it written lol
Jay_Levitt has joined #ruby
bglusman has joined #ruby
bwlang has joined #ruby
maletor has joined #ruby
philcrissman has joined #ruby
shtirlic has joined #ruby
nu7hatch has quit [#ruby]
mfridh has joined #ruby
wilmoore has joined #ruby
banisterfiend has joined #ruby
tommyvyo has joined #ruby
jalljo has joined #ruby
albemuth has joined #ruby
jrhorn424 has joined #ruby
hooper has joined #ruby
jmeeuwen has joined #ruby
banisterfiend has joined #ruby
jrhorn424_ has joined #ruby
rushed has joined #ruby
frishi has joined #ruby
drake10 has joined #ruby
PaciFisT has joined #ruby
looopy has joined #ruby
netrealm has joined #ruby
crodas has joined #ruby
igotnolegs has joined #ruby
swarley has joined #ruby
<swarley> about the mouse control
<swarley> curses offers a level of mouse reading
<swarley> just random reading im not sure
dzhulk has joined #ruby
burns180_ has joined #ruby
burns180_ has joined #ruby
linoj has joined #ruby
acts_as_david has joined #ruby
j3r0m3 has joined #ruby
cobragoat_ has joined #ruby
cobragoat has joined #ruby
jehoshua02 has joined #ruby
bglusman has joined #ruby
wilmoore has joined #ruby
bwlang has joined #ruby
zodiak has joined #ruby
Banistergalaxy has joined #ruby
adamkittelson has joined #ruby
sako has joined #ruby
nfluxx has joined #ruby
nerdy has joined #ruby
Dexx1_ has joined #ruby
<Dexx1_> I am doing the Rails Tutorial by M. Hartl and I am failing a test and cant' figure out whats causing it: http://pastie.org/private/3pkbvlxr69htzkszefa0jw -- any ideas?
iocor has joined #ruby
sbussi has joined #ruby
iocor has joined #ruby
vju has joined #ruby
AndChat| has joined #ruby
<robert_> hm.. anyone here have much experience with TCPServer?
radic_ has joined #ruby
<swarley> robert_, i kind of do
<swarley> depends on what you want done
<robert_> I just rewrote a threading server I found online (under my own power) to a select() server and now it ain't accepting clients. it's just stuck at select()
<Dexx1_> is this a typo in M. Hartl's RoR tutorial ? --> no_email_user.should_not be_valid
<sbussi> hi, i need some help setting up rvm in ubuntu 10.04
jcromartie has joined #ruby
<swarley> robert_, source please?
<robert_> swarley: was actually in the process of doing that. :D
<swarley> :D okie
iamjarvo has joined #ruby
<banisterfiend> robert_: look into eventmachine or celluloid instead
<robert_> hm? for a server?
<banisterfiend> Yeah
<robert_> what can either offer me?
<banisterfiend> robert_: eternal life
<robert_> haha :p
<mikeric> is there a way to get the closest match for a string against an array of strings? for example..
<mikeric> closest_match('hello world', ['Helloworld', 'lorem ipsum', 'hllwrld']) #=> 'Helloworld'
<swarley> haaah
<swarley> gaaah*
<banisterfiend> swarley: congrats on the pull request!
<swarley> robert_, eventmachine can make things more event based and i think its threaded
<swarley> thanks :D
<swarley> im going to work on the history writing
<robert_> swarley: I see. :D
<swarley> banisterfiend, what issues did pry-coolline have?
<swarley> i prefer using TCPServer
<banisterfiend> swarley: just that uparrow/downarrow didnt work
<swarley> because i feel like i actually worked more to make it work
<swarley> og
<swarley> oh*
<swarley> the history doesnt seem to be working for me
fbernier has joined #ruby
<swarley> like, previous use history
<banisterfiend> swarley: yeah pry-coolline probably needs to wire up old readline history to its own history
<banisterfiend> i havent done that yet
<swarley> well
<swarley> i mean
<swarley> i need to make it work
<swarley> its not working for coolline period
<swarley> so im going to look at it
<swarley> should be an easy fix
<banisterfiend> swarley: in what sense? that was the whole point of uparrow/downarrow i can access previous history *in the same session* using pry-coolline
<banisterfiend> but i cant access history from the saved history file
<swarley> yes
<swarley> i can do history from the instance
<swarley> but not over multiple uses
<banisterfiend> Yeah, that's the job of pry-coolline i think
<banisterfiend> not coolline itself
<swarley> oh
<swarley> i see
<swarley> well then
<swarley> nevermind
<swarley> lol
<banisterfiend> :)
<swarley> banisterfiend, any more ideas i could work on?
<banisterfiend> swarley: well you could make that search-method code an actual pull request on pry, put into the appropriate command set, formatted correctly (i fix your weird indentation! :)) and add support for searching code snippets too
<swarley> oh, okay
<swarley> i'll add support for looking through snippits
qos has joined #ruby
<banisterfiend> swarley: Yeah, cool. Add C support for extra coollness :)
<banisterfiend> I mean, let it search through C method source code
<swarley> XD yeah i'll work on it
<swarley> im not sure as to how to find the source code in the first place
<banisterfiend> swarley: look at how show-method can access C source
<swarley> lol
<banisterfiend> for an idea of how to do it
<banisterfiend> but it's not so important
<banisterfiend> just focus on ruby stuff
<banisterfiend> and ill add C support later on
<banisterfiend> otherwise you might end up reinventing wheels :)
<swarley> kk
<swarley> banisterfiend, what file is show-method in?
<banisterfiend> swarley: you can use: show-command show-method
looopy has joined #ruby
<banisterfiend> swarley: show-command shows the source for a command
<banisterfiend> swarley: if u want to jump to definition of show-method in an editor, then install the pry-developer_tools plugin
<banisterfiend> and type: edit-command show-method
<swarley> i see
<Dexx1_> Can someone verify that "no_name_user.valid?.should_not == true " is not a typo from: http://ruby.railstutorial.org/chapters/modeling-and-viewing-users-one#sec:length_validation ?
<Dexx1_> I keep getting failed tests on that
<banisterfiend> Dexx1_: u might find #rubyonrails more helpful
<Dexx1_> banisterfiend: oh ok thanks
<swarley> what is method_object?
<banisterfiend> swarley: pry can answer *all* these questions :)
<banisterfiend> swarley: just explore around using show-method show-doc cd and ls
<swarley> xD okay
<banisterfiend> swarley: but its potentially an instance of Pry::Method
<banisterfiend> swarley: btw u may find _file_ useful
<swarley> kk
<banisterfiend> swarley: if you've just done show-method or show-doc then the file for that method/doc is stored in _file_ local
sdwrage has joined #ruby
<swarley> ph
<banisterfiend> swarley: u can then type: cat #{_file_} or even edit #{_file_} to open that file in an editor, or cat it out to teh screen
fbernier has joined #ruby
<swarley> hm
ringotwo has joined #ruby
Chryson has joined #ruby
<sam113101> how do I make multiple functions private, at once?
<sam113101> private :function_name
<sam113101> private :function_name2
<sam113101> can I do this in one line?
rohit has joined #ruby
<sam113101> private :function_name, :function_name2
<sam113101> fucking genius
burns180 has joined #ruby
savage- has joined #ruby
<swarley> banisterfiend, looking at all this source
brianpWins has joined #ruby
kevinbond has joined #ruby
atani has joined #ruby
<basdfasdf> swarley: also u can join #pry if u like
<Dexx1_> basdfasdf: :( .. nothing yet. if you could peak at it it would be great. My guess is that its something small
wroathe has joined #ruby
alx- has joined #ruby
edogawaconan has joined #ruby
freeayu has joined #ruby
ZachBeta has joined #ruby
ZachBeta has joined #ruby
dfamorato has joined #ruby
mikeric has joined #ruby
tk___ has joined #ruby
davidcelis has joined #ruby
chimkan___ has joined #ruby
CheeToS has joined #ruby
dfamorato has joined #ruby
rippa has joined #ruby
SegFaultAX has joined #ruby
albemuth has joined #ruby
nari has joined #ruby
ZachBeta has joined #ruby
akemrir has joined #ruby
nfluxx has joined #ruby
rtdp has joined #ruby
rohit has joined #ruby
chimkan_ has joined #ruby
ringotwo has joined #ruby
burns180_ has joined #ruby
alek_b has joined #ruby
jehoshua02 has joined #ruby
jehoshua02 has quit [#ruby]
zealinux has joined #ruby
c0rn has joined #ruby
nikhgupta has joined #ruby
nikhgupta has joined #ruby
pu22l3r has joined #ruby
Banistergalaxy has joined #ruby
pu22l3r has joined #ruby
PaciFisT has joined #ruby
santos_jt has joined #ruby
looopy has joined #ruby
santos_jt has quit [#ruby]
<shevy2> gah
<shevy2> why is there no simple ruby GUI toolkit
hooper has joined #ruby
<basdfasdf> shevy: why dont u like QT ?
<shevy> qt is huge man
<shevy> and qt4-qtruby-2.2.0 fails to compile for me too :(
blueadept has joined #ruby
blueadept has joined #ruby
<basdfasdf> shevy: what GUI toolkit were you using before?
cobragoat_ has joined #ruby
j3r0m3 has joined #ruby
<basdfasdf> i remember seeing some gui stuff u did
<shevy> ruby-gtk
<basdfasdf> shevy: why did u choose that shevy
<shevy> but now with the new gtk versions, ruby-gtk chokes on what I have
<shevy> it sucked less than the others, had better documentation
akemrir has joined #ruby
pdtpatr1ck has joined #ruby
JeremyEvans_ has joined #ruby
<JeremyEvans_> Anyone having trouble updating ruby on rails to version 3.2.3? I'ved tried gem update rails and it's still showing rails -v 3.2.2 for some reason.
sirdeiu has joined #ruby
h4mz1d has joined #ruby
<akemrir> Did you updated Gemfile?
<rohit> !rubyonrails
<rohit> !rails
artm has joined #ruby
<TTilus> shevy: so ruby-gtk needs patches/pullrequests ;)
weirdpercent has joined #ruby
<basdfasdf> TTilus: do u wrestle?
<basdfasdf> TTilus: : do you wrestle?
<TTilus> do i need to?
senthil has joined #ruby
* TTilus prefers parkour
<weirdpercent> hey guys, I have one long text file I want to split into many separate files. the separator between each file is a date in the format of January 1, 2012 and the EOF separator is "End of Session". Right now I'm just trying to match the month so I can recognize the date of the session, how do I do this with a regex?
<TTilus> it helps when u wanna avoid wrestling
<TTilus> weirdpercent: .scan might be your thing
LeNsTR|e has joined #ruby
<TTilus> weirdpercent: with something like /^\w+ \d\d?, \d{4}/
krz has joined #ruby
<TTilus> weirdpercent: mm, or just .each_line and a .match inside loop that controls a statemachine (within session or not)
<weirdpercent> TTilus: thanks I will try that and see what happens
burns180 has joined #ruby
vandemar has joined #ruby
buschhardt has joined #ruby
Sgeo_ has joined #ruby
Rezwan has joined #ruby
Chryson has joined #ruby
greenarrow has joined #ruby
thatdudeguy has joined #ruby
<shevy> TTilus well my C knowledge is basically 0 :(
x0F_ has joined #ruby
Notimik has joined #ruby
nopolitica has joined #ruby
jmfcool has joined #ruby
sako has joined #ruby
maletor has joined #ruby
<senthil> you know what's wrong with most intro books? they don't teach you to use the debugger from page 1
<shevy> or
<shevy> these languages are too complex
<shevy> then again, what belongs to a debugger? In Io you can introspect any method at run-time, would that not be debugging too?
jmfcool has joined #ruby
tommyvyo has joined #ruby
<senthil> if you can stop each line and inspect vars, then yea
burns180 has joined #ruby
<shevy> hmm not sure Io allows that
tommyvyo has joined #ruby
<senthil> what exactly does "introspect" mean
maletor has joined #ruby
<TTilus> repl should be on page one
<TTilus> intercepting/introspecting runnin program (with whatever tools available) should be there, but maybe not on page one
<shevy> hmm basically I think that you can inspect the source of any method at runtime ... http://www.iolanguage.com/about/faq/ http://blog.clome.info/io-day-two/
<shevy> I used to have an example here, but that was 5 years ago, I cant find anything anymore :(
<shevy> I think it would be like in ruby having the ability to inspect every method (and variable? I forgot) at runtime, for every object
<senthil> ah
<shevy> sadly the syntax in Io is not so nice
<shevy> Me time := method(at, "Hello There! the time is " .. at asString("%H:%M:%S") println)
<senthil> ":=" is that assignment?
<shevy> yeah :(
<shevy> = means update slot
<shevy> I think that was one mistake, but overall it is way too verbose IMO
<shevy> ruby spoiled me
<senthil> and "perform" is the dot operator?
pzol has quit ["Sayonara!"]
<shevy> hmm dont think so. I think it uses ' ' as the "dot operator"... everything is an object in Io too
<shevy> Delay send
<shevy> Delay.send
<shevy> time(Date now)
<shevy> time(Date.now)
<senthil> i c
SullX has joined #ruby
senthil has joined #ruby
qos has joined #ruby
rohit has joined #ruby
jwmann has joined #ruby
ringotwo has joined #ruby
robbyoconnor has joined #ruby
jimmyy111 has joined #ruby
vitoravelino`afk has joined #ruby
buschhardt has joined #ruby
a_meba has joined #ruby
MrGando has joined #ruby
a_meba has joined #ruby
maletor has joined #ruby
senthil has quit [#ruby]
senthil has joined #ruby
mechanic_ has joined #ruby
becom33 has joined #ruby
dankest has joined #ruby
<dankest> If I'm using a loop like: for object in objects
<dankest> Can I limit how many objects it goes through?
nari has joined #ruby
<dankest> like, if I wanted to limit to the first three
dankest has quit [#ruby]
<Mon_Ouie> array.first(3).each { |object| … }
dankest has joined #ruby
trivol has joined #ruby
senthil has joined #ruby
sbussi has joined #ruby
<shevy> dankest for loops are typically rather un-rubyish to solve any given problem
<rippa> https://www.google.com/search?q=sqrt(x*x%2By*y)%2B0.5*cos(sqrt(x*x%2By*y))%2B5
CheeToS has joined #ruby
<dankest> shevy: What would you recommend?
<shevy> dankest .each
KL-7 has joined #ruby
<shevy> you could also split up the tasks at hand
<shevy> (1) gather which objects you want to process (and which not) (2) pass these objects to a tiny method
ghostlin1s has quit [#ruby]
<dankest> shevy: thanks. I like that latter solution
maletor has joined #ruby
<shevy> the advantage of using methods is that you can build components of your code, and can re-use them (or change them) lateron very easily too
mfridh has joined #ruby
<shevy> and code can evolve on its own that way. like, when you write a class and maintain this class over the years
nemesit has joined #ruby
h4mz1d has joined #ruby
maletor has joined #ruby
blacktulip has joined #ruby
apeiros_ has joined #ruby
freeayu_ has joined #ruby
ph^ has joined #ruby
hakunin has joined #ruby
hakunin has joined #ruby
qos_ has joined #ruby
falena has joined #ruby
savage- has joined #ruby
dyeske has joined #ruby
atani has joined #ruby
mikeric has joined #ruby
looopy has joined #ruby
<pcboy_> Hi guys. I've an encoding problem. I'm unmarshalling objects saved with ruby 1.8 in a membase db. The strings seems to be in ASCII encoding. The truth is that it's UTF8 strings. I know that I can do a .force_encoding 'UTF-8', but I want a dry way to do that. I've tried Encoding.default_external = Encoding::UTF_8 and Encoding.default_internal = Encoding::UTF_8 that doesn't work. Why are my strings setted in ASCII and not UTF-8 by default?
<pcboy_> It's the dalli gem who makes the Marshal.load().
<swarley> did you try
<swarley> # encoding: UTF-8
<swarley> oh
<swarley> uhh
<pcboy_> Yeah I tried.
<apeiros_> pcboy_: why don't you write a one-off script that converts all data in your membase db?
<pcboy_> There is a fair amount of data. That more complicated than it seems.
sj26 has joined #ruby
<apeiros_> fair amount of data just means that it'll take a while to run…
<swarley> lol
<pcboy_> The only way to do that correctly would be to first having the list of the keys. And I don't have these. You must use the TAP interface of membase to do that. If I can find a better way I would be happy.
somazero has joined #ruby
<pcboy_> And btw my objects are complex. I don't want to do that on each of their attributes.
ringotwo has joined #ruby
prometheus has joined #ruby
Nss has joined #ruby
liluo has joined #ruby
jnraine has joined #ruby
batmanian has joined #ruby
<pcboy_> There should be a way to do that. My strings shouldn't have .encoding because they are from 1.8, so the .encoding method is added. So there should be a way to force the encoding to utf-8.
<apeiros_> it is more likely that if no encoding is stored in the serialization, marshal defaults to binary. it it's not unlikely, that there's no way to override that default.
KL-7 has joined #ruby
<apeiros_> you can try adding a marshal_load method to String
<apeiros_> beware, if it works, it'll most likely reduce performance a good bit
<pcboy_> It's strange that there is no way to override that. The Encoding.default_internal/external should be used.
<apeiros_> no, they shouldn't
justinmcp has joined #ruby
<pcboy_> Why ?
<apeiros_> marshal is a binary serialization. there's no point in applying encoding.
<pcboy_> Mh, yeah, fair.
bjensen has joined #ruby
two- has joined #ruby
jonteru has joined #ruby
shruggar has joined #ruby
crodas has joined #ruby
sdeobald_ has joined #ruby
bier has joined #ruby
banisterfiend has joined #ruby
<banisterfiend> artm: ping
<artm> pong
twinturbo has joined #ruby
<banisterfiend> artm: you were talking about ease of re-editing methods in a repl (irb or pry) and your frustration at having to re-type the method definition every time you wanted to change something?
<banisterfiend> artm: in pry, you can just ytpe: edit-method method_name and it'll let you edit the current method as it is
<banisterfiend> you dont have to retype the whole thing
<artm> hang go /me 's going to try
* artm 's going to pry
<banisterfiend> artm: you may have to properly configure your Pry.editor
<banisterfiend> but it should work ok, if you're already in a *nix
adambeynon has joined #ruby
<banisterfiend> artm: you're in rubhy 1.8?
<artm> yes
<banisterfiend> artm: this functionality only works in ruby 1.9+
<artm> (in that window)
<banisterfiend> artm: why are you still in 1.8 ? :)
<artm> I see
<banisterfiend> artm: yeah it's 1.9 only
<artm> it's system ruby on my macbook
<shevy> :)
<banisterfiend> artm: btw unless you have good reason, you really shouldn't be using 1.8 :) (for the good that you unnecessarily miss out on a lot of cool 1.9 only stuff)
<banisterfiend> artm: yeah, you should setup rvm, srsly
<artm> I use rbenv
<banisterfiend> rbenv too, whichever
<banisterfiend> but set your default to 1.9
<banisterfiend> artm: anyway, let me know how you get on in 1.9
<artm> it's just that my irc instance of pry was open with system ruby
<artm> no, I will not default to non-system ruby
<banisterfiend> artm: everyone else does :) System ruby is out of date :)
qos has joined #ruby
<banisterfiend> artm: the only people i know who actually use the the version of ruby that comes bundled with macosx are noobs who just dont know any better yet
<artm> not everyone else
<artm> exactly, you're talking about my clients
<banisterfiend> argh, poor you. oh well
<artm> not really. i write simple things in system ruby, so that don't need to upgrade ruby for simple things
<artm> for complex things I use 1.9 and ... I have no strategy for deploying it yet :)
<artm> yep, edit method opens it in vim
<artm> nice
<artm> thanks
<banisterfiend> np
ephemerian has joined #ruby
ephemerian has quit [#ruby]
qos has joined #ruby
rubicon917 has joined #ruby
atani has joined #ruby
krzkrzkrz has joined #ruby
basdfasdf has joined #ruby
davidpk has joined #ruby
williamcotton has joined #ruby
ewokchewy has joined #ruby
ewokchewy has quit [#ruby]
dv_ has joined #ruby
rohit has joined #ruby
wilmoore has joined #ruby
nikhgupta has joined #ruby
cha1tanya has joined #ruby
liluo has joined #ruby
basdfasdf has joined #ruby
thecreators has joined #ruby
rodayo has joined #ruby
<rodayo> I'm using this: "lut = Hash.new { |h, i| h[i] = i.to_s(2) }" to generate a sequence of binary strings...how can I make the strings a fixed length of 8 bits? Right now they vary from 1 to 8 bits as I go from 0 to 255
<apeiros_> use String#%
<apeiros_> "%08b" % i
basdfasdf has joined #ruby
<rodayo> apeiros, I haven't seen that before could you explain it?
Azure|netbook has joined #ruby
<apeiros_> you know printf?
<rodayo> yes
<apeiros_> String#% is just sprintf
<apeiros_> in a bit more OO fashion
pzol has joined #ruby
<rodayo> In my case I tried "08b" % lut[2].to_i but it output "00001010"
basdfasdf has joined #ruby
<apeiros_> …
<apeiros_> I thought it was obvious what you should replace i.to_s(2) with "%08b" % i
<apeiros_> there's a reason I used the same var-name as you…
d3c has joined #ruby
<rodayo> apeiros_, my bad, thx
<apeiros_> if your hash isn't sparse (i.e., all keys from 0 to 255 are present), then you should use an Array
atani has joined #ruby
<rodayo> it's some performance critical thing....i'm just using this to generate a bunch of VHDL code that I'd rather not type out
<apeiros_> array lookup by index is faster than hash lookup by key
liluo has joined #ruby
<rodayo> *it's not
nikhgupta has joined #ruby
<apeiros_> what makes you think it wasn't?
<apeiros_> (because you're provably wrong)
hiland has joined #ruby
<apeiros_> you're probably thinking of finding a value in an array, which is O(n) and indeed slower than a key lookup in a hash
<apeiros_> but accessing an array by index is O(1), same as a Hash, but with a lower k (it doesn't need to calculate a hash. index + address calculates the position of the item directly)
robotmay has joined #ruby
shruggar has quit [#ruby]
venkatk_ has joined #ruby
<rodayo> apeiros, i know what hashes and arrays do...
<apeiros_> then why do you think a hash lookup was faster than an array lookup?
<rodayo> my point is it's a one time script and there's no need to optimize it
<rodayo> apeiros_, i didn't...i just thought it up and used it
n1x has joined #ruby
<apeiros_> errr, you just said "it's some performance critical thing" before…
<rodayo> <rodayo> *it's not
<apeiros_> well, whatever…
<apeiros_> ah, the "it's not" was related to your own statement, not to mine about lookup performance. ok.
<rodayo> hahaha sry about that
eldariof has joined #ruby
ikaros has joined #ruby
francisfish has joined #ruby
bluOxigen has joined #ruby
<apeiros_> so, my mbench and pbench methods finally use cpu time instead of realtime
MrGando has joined #ruby
LowKey has joined #ruby
rtdp has joined #ruby
<rtdp> count
d3vic3 has joined #ruby
nikhgupta has joined #ruby
mcwise has joined #ruby
nikhgupta has joined #ruby
Guest83733 has joined #ruby
Foxandxss has joined #ruby
emmanuelux has joined #ruby
kirun has joined #ruby
buschhardt has joined #ruby
Houdini has joined #ruby
Trumma has joined #ruby
arvidkahl has joined #ruby
artm has joined #ruby
kaneda has joined #ruby
bjensen has joined #ruby
luckyruby has joined #ruby
kaneda__ has joined #ruby
kidoz has joined #ruby
waxjar has joined #ruby
becom33 has joined #ruby
scalebyte has joined #ruby
lottadot has joined #ruby
mrwalker has joined #ruby
pyreal has joined #ruby
rohit has joined #ruby
<pyreal> I'm writing a class that has a .to_html method. I want to do a similar method that generates plain text. Is it canonical to use the to_s method for this or should I use the more explicit to_text? any opinions?
Natch| has joined #ruby
dbgster has joined #ruby
gtuckerkellogg has joined #ruby
mcwise has joined #ruby
mengu has joined #ruby
arvidkahl has joined #ruby
Morkel has joined #ruby
<pyreal> I think i'll use .to_text (and the accompanying .custom_text), and then alias .to_s to .to_text
<scalebyte> pyreal: yes that will be better
<scalebyte> pyreal: could you help me with this -> https://gist.github.com/2262628
buschhardt has joined #ruby
<pyreal> too early on a Saturday morning for that much of a brain-twister :P
<scalebyte> pyreal: but if you help me I will get myself a job :)
<canton7> scalebyte, don't you think's it's, well, cheating, to ask for answers to job questions on here?
<pyreal> heh and what will i get? a headache?
<canton7> you told us these were homework questions the other day
<pyreal> the job is helping the teacher clean the chalkboard? :P
<scalebyte> canton7: Yes only if I do homework well will I get a job :)
<scalebyte> pyreal: canton7 seriously send me the solution with your email ID and you guys could seriously stand a chance to win an Amazon Kindle fire !!
<scalebyte> scalebyte: This is part of their talent hunt.. I will take the job and you guys can take home kindle :)
<canton7> scalebyte, but you're not really demonstrating your talent, if you get us to do it :)
<scalebyte> canton7: this is how you help humanity brother.. I will prepare for the interview.. my mother is poor and sick I need to support her and get a job fast
<canton7> scalebyte, franky, I've worked alongside people who weren't competant enough for their role. I wouldn't wish that on anyone else. For the sake of your future co-workers, I'm not going to help
<scalebyte> canton7: you never wanted to help :)
<scalebyte> canton7: nobody wants to help me and my mother
<pyreal> i have actual code to deliver and already have multiple kindles :P
<canton7> yeah, the kindle fire's never tempted me. The e-ink ones, though, are gorgeous :P
<scalebyte> canton7: pyreal :( :'(
jonteru has joined #ruby
<apeiros_> scalebyte: stop playing on the heart strings
<scalebyte> apeiros_: you are blessed amen :)
<apeiros_> scalebyte: you mistake "help" and "doing your work". we do help. we do *not* do your work.
arvidkahl has joined #ruby
<scalebyte> apeiros_ : That's a sad thing
<apeiros_> and if you keep asking like that, I'll kickban you.
<canton7> sweet!
<scalebyte> pyreal: so cute :)
<apeiros_> scalebyte: work on the problem, try to solve it yourself, and if you have a specific question, ask. but stop asking people to do the work for you.
<scalebyte> apeiros_: the think is I have 5 challenges and just 1 hour and 48 minutes left to complete all.. I cant finish that in this time.. I need help thats why I am asking for help.. unlike your misconception that I am lazy.. Your Honour
<canton7> scalebyte, the majority of that question isn't ruby-specific at all -- it's sorting out the algorithm. This channel's name is #ruby -- this is a hint to which bit we'll help out with
<scalebyte> canton7: I need to write the program in any language.. ruby is also allowed
<apeiros_> scalebyte: again, you weren't asking for help, you were asking for people to do it for you. and you running out of time is not our problem.
<scalebyte> apeiros_: agree ...
buschhardt has joined #ruby
<apeiros_> with N = 10, there's 4**9 permutations for the operators, sadly with the parens, that gets increased quite a bit
<apeiros_> the operator permutation part is probably not too difficult, but the parens make it somewhat difficult
<scalebyte> apeiros_: hmmm
<scalebyte> apeiros_: finding it damn tough
atmosx has joined #ruby
<canton7> would postfix notation help? I'm thinking it might allow you to avoid the brackets
<Tasser> apeiros_, gimme op and I'll fix that for you ;-)
<apeiros_> Tasser: ?
kidoz has joined #ruby
<apeiros_> canton7: don't have experience with postfix notation :-/ might be that a different way to present the problem makes the solution more obvious
<Tasser> apeiros_, kickban n stuff :-)
peterhellberg has joined #ruby
<scalebyte> apeiros_: canton7 pyreal you can also try this also -> https://gist.github.com/2262955
<apeiros_> Tasser: I'm not ready to kickban him yet. I do believe him that he genuinely seeks help.
goganchic has joined #ruby
<Tasser> aww :-(
<scalebyte> Tasser: apeiros_ is my friend we know each other for quite some time now.. He is not that bad at heart to ban me all right !!
<apeiros_> scalebyte: I'm sorry, but I don't think we're friends
<apeiros_> (tasser otoh is a friend of mine)
<scalebyte> apeiros_: we are aquaintances
<apeiros_> which I still owe a visit :)
<apeiros_> acquaintance is acceptable
etehtsea has joined #ruby
<apeiros_> scalebyte: given that it seems that you can't solve many of those questions by yourself - aren't you aiming a bit too high?
schovi has joined #ruby
<scalebyte> apeiros_: not really its too high with the given time.. i work hard.. got award last year for my work on semantic analysis and web apps on RoR.. I am not as bad as you think :)
chimkan has joined #ruby
<apeiros_> ah, hm, instead of thinking in parens, just think in precedence
<apeiros_> there's 9! possible orders of execution with 9 operators
<Tasser> how do I take one element from an interator? #first doesn't seem to remove it
<apeiros_> so we have 4**(N-1) * 9! possible calculations with N digits
<apeiros_> and a naive solution to that isn't that hard
<apeiros_> Tasser: drop
<apeiros_> but I think that returns an array (which is a shame)
<Tasser> which kinda sucks, because I've got ary.cycle
<apeiros_> I've a reimplementation of drop lying around, which returns an enumerator again
<apeiros_> and of course I didn't file it correctly… gah
<Tasser> crap, that crashed my machine
<Mon_Ouie> Wouldn't it rather be Enumerator#next that you're looking for?
<Tasser> likely
<apeiros_> oh, right, that exists too…
<Tasser> but I need to wait until oom_killer sets in :-(
<Tasser> indeed
<apeiros_> hrm, 95_126_814_720 is quite a lot possible permutations, ruby won't be fast enough for inputs with N = 10
pu22l3r has joined #ruby
pu22l3r has joined #ruby
<Tasser> Mon_Ouie, any idea why #next isn't in http://rubydoc.info/stdlib/core/frames ?
mengu has joined #ruby
mengu has joined #ruby
<Mon_Ouie> Because it's in Enumerator, not Enumerable
srji has joined #ruby
<Mon_Ouie> You can't do array.next just with each, that involves somehow changing state
pdtpatr1ck has joined #ruby
twinturbo has joined #ruby
nikhgupta has joined #ruby
basdfasdf has joined #ruby
frishi has joined #ruby
<scalebyte> apeiros_: I am stuck up with iterating the array elements and performing binary operations on them
<apeiros_> scalebyte: I'm preparing to leave. paste your code, but not sure I'll have enough time to help. but maybe somebody else can.
<scalebyte> apeiros_: Its ok.. mate thansks for your words.. let me try it :)
mengu_ has joined #ruby
mengu_ has joined #ruby
n1x has joined #ruby
scalebyte has quit [#ruby]
<n1x> what does `return :something` mean? particularly ':something' ?
<gogiel> n1x: it's symbol. google it
pac1 has joined #ruby
<n1x> gogiel, can it be a method?
<Mon_Ouie> No, :something is an Object, a Symbol specifically
<n1x> gogiel, i'm googling, but i wanted exact words to search for!
<gogiel> n1x: symbol is just const string. you can convert it to string, you can convert it to class, method, anything
ghostlines_ has joined #ruby
<Mon_Ouie> Just like 3 is an Integer and "foo" a String
<n1x> gogiel, Mon_Ouie thanks.
Danielpk has joined #ruby
<gogiel> n1x: symbols are often used to pass method names
<gogiel> or class name
<n1x> gogiel, okay so i should be searching 'symbols in ruby'
<gogiel> n1x: symbols is just const string
<gogiel> but it's used everywhere
excor has joined #ruby
<n1x> gogiel, okay.. i'll read some details about it
nikhgupta has quit [#ruby]
<matled> n1x: for the general concept, not specific to the use in ruby, google for string interning
<n1x> matled, okay.. I'll look up that.
katya has joined #ruby
luckyruby has joined #ruby
buschhardt has quit [#ruby]
drake10 has joined #ruby
choffstein has joined #ruby
becom33 has joined #ruby
<becom33> http://pastebin.com/YgYyp9PR Im getting a error
Vendethiel has joined #ruby
albemuth has joined #ruby
<becom33> anyone >
* becom33 elo ? is everyone sleeping ?
<canton7> becom33, no, we're just doing other things as well
excor has quit [#ruby]
<canton7> becom33, what error?
choffste_ has joined #ruby
<canton7> becom33, the most obvious problem is that line 4 says "detial" and line 9 says "detail"
cpruitt has joined #ruby
<becom33> canton7: damn it
<becom33> :( sorr
<becom33> sorry *
basdfasdf has joined #ruby
sdwrage has joined #ruby
Squarepy has joined #ruby
Squarepy has joined #ruby
nari has joined #ruby
basdfasdf has joined #ruby
Nodza has joined #ruby
dagnachewa has joined #ruby
imapickle has joined #ruby
<imapickle> glBufferSubData(GL_ARRAY_BUFFER, sizeof(MenuContextVertices), 6 * sizeof(float), MenuContextVertices);
<imapickle> is this the correct way to use this ? ^^
basdfasd_ has joined #ruby
kaneda has joined #ruby
lkba has joined #ruby
Nodza has quit [#ruby]
seanstickle has joined #ruby
IrishGringo has joined #ruby
sayakb_ has joined #ruby
luckyruby has joined #ruby
Karmaon has joined #ruby
rippa has joined #ruby
Vert has joined #ruby
<n1x> help me understand this -> http://pastie.org/3703623
<n1x> i was expecting the output to be 10
Danielpk has joined #ruby
ephemerian has joined #ruby
thecreators has joined #ruby
<Mon_Ouie> @foo is used to access the @foo ivar of self. Self, in the context in which you set @foo to 10, was Polygon.
<Mon_Ouie> It could not have been the instance you created, because you did it *after* setting @foo
<lkba> you should initialize this variable in constructor
<n1x> lkba, yeah, i will, but i'm trying to understand the class vars vs instance vars
Guest86874 has joined #ruby
basdfasdf has joined #ruby
iocor has joined #ruby
dwon has joined #ruby
<Mon_Ouie> You mean the difference between class vars and instance variables at class level?
<matti> Mon_Ouie: Probably that what he means :)
<lkba> class is object in ruby
<Mon_Ouie> matti: 'alut, btw ;)
<n1x> Mon_Ouie, yes. i don't know what class level is! but i'm trying to understand the diff bet class variables and instance variables
<Mon_Ouie> n1x: class-level just means when self is a class
<matti> Mon_Ouie: Hi, Hi ^-^
<Mon_Ouie> Class variables will be shared between classes
rtdp has joined #ruby
<n1x> Mon_Ouie, like static variables in other programming languages?
<Mon_Ouie> (I mean, with subclasses)
<Mon_Ouie> What programming language specifically?
dql has joined #ruby
<n1x> Mon_Ouie, C++ ?
<Mon_Ouie> Then, if declared as part of a class, yes
<n1x> Mon_Ouie, ah okay.. and what about the instance variables? they will be there with object only?
buschhardt has joined #ruby
Teomari has joined #ruby
fbernier has joined #ruby
Kiall has joined #ruby
<Mon_Ouie> Except that, as lkba mentioned, even a class is an object
<Mon_Ouie> So a class can have its own instance variables
<Mon_Ouie> class Polygon; @sides = 10; end; Polygon.instance_variable_get(:@sides) #=> 10
<n1x> (grr!! it's kind of inception here :P)
td123 has joined #ruby
pavelz has joined #ruby
<n1x> Mon_Ouie, hmm.. I understood now.. thanks (new concept learned "even class is an object", which made some more things clear :) )
Morkel has joined #ruby
zunnyohno has joined #ruby
a_meba has joined #ruby
a_a_g has joined #ruby
Guest86874 has joined #ruby
flak has joined #ruby
Sailias has joined #ruby
araujo has joined #ruby
araujo has joined #ruby
scholar01 has joined #ruby
scholar01 has joined #ruby
delinquentme has joined #ruby
Guest86874 has joined #ruby
otters has joined #ruby
<shevy> dumdedum
`brendan has joined #ruby
rippa has joined #ruby
<matti> shevyyyy
<matti> ;]
sepp2k has joined #ruby
zakwilson has joined #ruby
<shevy> matti hmm
<shevy> I will never again rewrite a large project
<`brendan> anyone know where the find the centos repos listing ruby?
<`brendan> want to see which versions are avail
<shevy> no idea
<Tasser> `brendan, ruby guys are infected by a mac ecosystem - they got their own package manager ;-)
<`brendan> heh
<`brendan> maybe ill just go with rvm
<shevy> who wants to write a package manager in ruby
<daed> everyone does
<daed> doesn't it sound like so much fun?!@#?
<shevy> I havent found anyone yet who wants to :(
<any-key> because we're all writing cool web apps and shit
<any-key> or driving roombas
qos_ has joined #ruby
alx- has joined #ruby
forest| has joined #ruby
<shevy> hmm
zakwilson has joined #ruby
<shevy> that's what I shall do then
<shevy> a ruby web app for a ruby package manager
<becom33> http://pastebin.com/9tkZ4hS2 help ? I have explained what I want to do in the paste
ZachBeta has joined #ruby
<shevy> lass Test? becom33 :)
noyb has joined #ruby
<shevy> name = ()
<shevy> what is this
<shevy> I know that this is neither a Hash nor an Array
<shevy> also the two classes are the same, if you load the second file, I think it will overrule what is written in the first file (in regards to class Test)
<shevy> if you want persistent variables in classes, make them instance variables like @foo
<shevy> detail = {
<shevy> to
<shevy> @detail = {
dbgster has joined #ruby
basdfasdf has joined #ruby
td123 has joined #ruby
rtdp has joined #ruby
<becom33> shevy: I'll tell you the base Idea , yes two classes are the same . that the way it has to be . I want the hash vlaues in the those two classes to come to the emtpy arrays in the Read the class
<shevy> your base idea will be better when your implementation detail is correct. right now that is not even ruby code
<shevy> it's really easier to build slowly what you need and proceed from there, solving one problem at a time
<becom33> ok I'll ask you one by one. gimme a idea I'll code n you can tell me weda Im doing that correctly
<shevy> and for instance, you write:
<shevy> "detail = () # i want to have the above files details hash 'detail' key value in this detail array"
<shevy> but that is neither valid ruby syntax, nor could you use an array like a hash in ruby
sepp2k has joined #ruby
<shevy> and then you also use things like:
<shevy> #include Notifier
<shevy> if this is not important for the problem you solve, it is better to omit this entirely
fr0gprince_mac has joined #ruby
<becom33> ok firstly I have few ruby files in a folder , all the classes in the files are the same except the details inside the class .
<becom33> the problem I have is I need to write a another classes to go to that folder read those all files
<becom33> then add those details into defferent defferent arrays
<shevy> I am quite sure your problem is easy, but I still did not understand it, sorry
<becom33> shevy: did u underatnd what I said before
<shevy> no :(
<becom33> above ?
<becom33> ok
<becom33> umm
ryanRT has joined #ruby
<shevy> The only thing I understand is that you have two different .rb files with both having one class defined, class Test
<becom33> I have two folders named 'rubyone' 'rubytwo' ok ?
<shevy> directories
<shevy> ok so you have:
<becom33> yes
<shevy> rubyone/
<becom33> sorry
<shevy> rubytwo/
<shevy> so far I understand
wilmoore has joined #ruby
<shevy> continue :)
<becom33> and I have files with the same class and same stucture
<shevy> in those directories?
<shevy> rubyone/file1.rb
<becom33> but the details in those files are deffrent
<becom33> yes
<shevy> rubytwo/file2.rb
<shevy> ok
<shevy> hmm what details
<shevy> only in "def initialize" ?
<becom33> shevy: in the paste I showed u before
<becom33> yes only in def initialize
<shevy> well that paste is odd
<shevy> you pass an argument called "com"
<shevy> but you never use it
buschhardt has joined #ruby
<shevy> ok, so we have ... rubyone/file1.rb and rubytwo/file2.rb with class Test. both files have another def initialize way
<becom33> class names are the samet too
<shevy> actually, my first question:
<shevy> Why dont you use the same class?
<shevy> because both seem to be initialized via a hash anyway
<becom33> I do use the same class
<shevy> so the only thing you would have to do is pass the correct information to def initialize
<becom33> shevy: im sorry I dont undertand .
<shevy> you write the class Test twice
<shevy> I dont understand why you must do this
<shevy> the only thing that differs is the data you pass
<becom33> yes
<shevy> hmm a moment
<becom33> and I have file called read.rb in the root directry of this two /rubyone /rubytwo
<shevy> becom33, http://pastie.org/3703890
<shevy> yeah, in your file read.rb
<shevy> load the other .rb files
<shevy> require 'rubyone/file1.rb'
<shevy> require 'rubytwo/file2.rb'
<shevy> but I still dont think you need to redefine class Test at all
<shevy> in file read.rb simply require those files you need
<shevy> and then instantiate Test.new
<shevy> with different params
<shevy> (1) _ = Test.new
<becom33> shevy: the thing is I cant require file1.rb and file2.rb
<shevy> ^^^ This uses the default, as defined in the constant DETAIL
<becom33> file names can be anything
<shevy> you cant require it?
Hadrian has joined #ruby
<shevy> can you use a glob?
<Hadrian> h
<Hadrian> hi
<Hadrian> is anybody here?
<becom33> and there could be more than one file in side that class
<shevy> becom33, Dir['*.rb'].each {|r| require r}
<shevy> becom33, Dir['rubyone/*.rb'].each {|r| require r}
<becom33> but even if there are like 100 files , all the files has the same class
<shevy> well simply load all .rb files
<shevy> or glob them to your criteria
<becom33> and has the same stucture
<shevy> crazy code :)
<Hadrian> what are you discussing herE?
<shevy> Hadrian ruby
schovi has joined #ruby
<Hadrian> what?
<becom33> shevy: wait I did look at pastie yes . one second
<shevy> Hadrian the programming language
<becom33> didnt *
<shevy> Hadrian if you used php, come use ruby instead
<becom33> shevy: whats 'pp' ?
<shevy> becom33, btw, pastie.org has nicer colours than pastie
<shevy> pp means pretty print
<shevy> becom33, start irb and do this:
<becom33> shevy: Im on linux . how can start irb ?
<becom33> I know its basics but I always did coding in files
<shevy> you simply do "irb"
<shevy> in a terminal/shell
<shevy> have you started it?
<becom33> yes
<shevy> ok good, do this:
<shevy> require 'pp'
<shevy> array = %w( cat dog elephant crocodile mouse tiger lion superdragon )
<shevy> pp array
<shevy> ---
<shevy> that's it
<shevy> then you will see what pp does, it pretty prints the array
<shevy> it is super useful to test small snippets of ruby code
cdepue has joined #ruby
<shevy> glad to see you are on linux, windows can be annoying ;)
<becom33> ko
<becom33> ok *
<becom33> he he thanks . I dont windows is a good os for programing
<shevy> btw, you can use EVERY ruby code in irb too, so you can even build an ruby environment that way and load all files you deem useful
<becom33> specially terminal codes
<becom33> I see
<shevy> on startup, irb reads ~/.irbrc so you can require extra files in there
<shevy> and if you want nice colours, you can use the wirble gem
<shevy> gem install wirble
jmeeuwen has joined #ruby
<shevy> and then in irb you load wirble... anyway, that's just for nicer colours
<becom33> btw shevy Im having a error in your code :/
<shevy> there is also ap, awesome print, which has even more colours. but I find it has too many colours
<becom33> test.rb:9:in `initialize': uninitialized constant Test::DETAILS (NameError)
<shevy> yeah sorry
<shevy> I changed the name to DETAIL I think
<becom33> the S
<shevy> yeah
<becom33> he he yea
<shevy> is a simple fix :P
<becom33> I know you gave me the code to include all the files in the rubyone and rubytwo code . but I coudnt catch it .
<becom33> :(
<shevy> in IRB, test it
<shevy> go to the directory where there is rubyone/ and rubytwo/ ok?
<shevy> and put example .rb files in those directories
<shevy> then, when you are in IRB, try it:
<shevy> Dir['rubyone/*.rb']
<shevy> you can also use Dir.glob
<shevy> it has examples:
sdeobald has joined #ruby
<shevy> Dir.glob("config.?") # => ["config.h"]
<shevy> it uses pattern matching similar to bash/zsh
<shevy> but *.rb should be enough for your case
<becom33> shevy: I have to do Dir['rubyone/*.rb'] and Dir['rubytwo/*.rb']
<becom33> also right ?
<shevy> try in IRB
<shevy> you will get instant results
<shevy> but yeah, the name of the directory
<shevy> you could even do Dir['**/**']
<becom33> yes I see
<Hadrian> i'm searching for a girl...
rtdp has joined #ruby
<becom33> Hadrian: girl or a date ?
`brendan has quit [#ruby]
<shevy> lol
<Hadrian> girl1!
<shevy> Hadrian this is about ruby here, you wont find girls
mhz has joined #ruby
<Hadrian> ok
<becom33> shevy: so now how can I add those has values in two a error ?
<shevy> what
<shevy> reword please
<shevy> what error? where?
<becom33> array *
<becom33> sorry
<becom33> lol
<shevy> hmm
<shevy> what values do you need in array format?
<becom33> I need a array called 'name' and 'detail' so then if I do name[1] detail[1] it will give me the correct details from one class
<shevy> an array?
<shevy> array = [ 'name', 'detail' ]
<becom33> yea
<becom33> no no two arrays
<shevy> array1 = [ 'name', 'detail' ]
<shevy> array2 = [ 'name', 'detail' ]
<shevy> :)
Clordio_ has joined #ruby
<shevy> your problem is easy, the only difficulty is trying to understand you ;P
<becom33> name = ['test','lol'] detail ['this is test detial','this is lol details']
<becom33> detail = *
<becom33> mistake
<shevy> ok
<shevy> now you made two arrays
<shevy> array name
<shevy> and
<shevy> array detail
<shevy> what is the next step?
<becom33> shevy: I hope you get wha Im trying to say
<shevy> detail = ['this is test detial','this is lol details']
<shevy> detail[1] # => "this is lol details"
<becom33> I dont make array details
<becom33> I need to get array details from those class we made before
<shevy> aha, so this array does not exist yet
<shevy> suggestion:
<becom33> clases are inside the rubyone/ and rubytwo/
<shevy> extend class Test with a method
<shevy> that returns the information you need
<shevy> def return_array
<shevy> and then
<shevy> detail = Test.new.return_array
<shevy> (or the variable you assigned
<shevy> _ = Test.new
<shevy> detail = _.return_array
<becom33> shevy: cofused like nothing . if you could one little simple code paste . please please
<becom33> example *
apeiros_ has joined #ruby
kaneda__ has joined #ruby
<becom33> :) one moment . leme check that one
apok has joined #ruby
<shevy> you need to adjust it to read.rb probably
<shevy> the part inside if __FILE__ == $PROGRAM_NAME
<shevy> that should go into read.rb
<becom33> shevy: wait
<becom33> why cant we return in side the initialize ?
<seanstickle> People don't use $0 anymore?
<Mon_Ouie> You can, but it doesn't matter what you return when you call .new
<Mon_Ouie> Since .new just calls initialize on the object that it returns
Rezwan has joined #ruby
<Rezwan> #ruby-lang
<Mon_Ouie> seanstickle: Some do, I personally don't
<shevy> becom33 try if it works when you do
<becom33> shevy: wait I havnt made the read file yet
<becom33> so I have class called Read
<shevy> have you written it yet? :D
<shevy> that read.rb file must load all the .rb files you need
<becom33> and inside initalize I have wrote list = dir['rubyone/*.rb']
<becom33> thats it
<shevy> so use the Dir[].each ... require trick
<shevy> why is dir dir and not Dir?
fubhy has joined #ruby
<shevy> btw it is often better to make tiny methods
<becom33> fixed it sorry
<shevy> def initialize
<shevy> load_ruby_files
<shevy> def load_ruby_files
<shevy> @files = Dir['rubyone/*.rb']
<shevy> @files << Dir['rubytwo/*.rb']
kesor has joined #ruby
<shevy> hmm and then @files.each require...
<becom33> so ur asking me to create new methos and use it inside it ?
<Mon_Ouie> You probably meant .concat
<shevy> you may have to use .flatten first, but use pp @files
Squarepy_ has joined #ruby
<shevy> yeah or use .concat
<shevy> becom33 you should familiarize yourself with the methods in standard ruby
<becom33> shevy: lemmme paste n show you
<shevy> http://www.ruby-doc.org/core-1.9.3/Array.html there, read through that slowly at least once
basdfasdf has joined #ruby
<shevy> you dont have to memorize that, just so you saw the name
BigJasonWebb has joined #ruby
<shevy> http://www.ruby-doc.org/core-1.9.3/String.html this too, at least so you saw all method names
<shevy> that's it
<shevy> :D
<shevy> 3 important classes
<Mon_Ouie> Also check Enumerable
trivol has joined #ruby
<shevy> becom33 you dont have to manually do that
<shevy> you can put this into "def initialize
arturaz has joined #ruby
<becom33> you mean like method inside the initialize method
<becom33> ?
<shevy> becom33, http://pastie.org/3704042
basdfasdf has joined #ruby
<shevy> also run this file
<shevy> and look whether the output is correct
<shevy> yeah becom33
<shevy> it's not good to do this manually, usually
<becom33> aww like that
<shevy> read.fileread <-- this is not needed, unless you want to pass some different base directory to read from
<shevy> like...
<shevy> read.fileread('/tmp/bla/')
<shevy> which could designate another base directory you want to read from
<shevy> but you see, you can tie all the logic you need into your class, right?
<shevy> I have to go afk for ~20 minutes, sorry, need to prepare something for university
<becom33> yes I guess :/
arturaz has joined #ruby
n3m has joined #ruby
<becom33> ok have a good day . plase lemme know when u come back
havenn has joined #ruby
ginsun has joined #ruby
maletor has joined #ruby
senthil has joined #ruby
senthil has quit [#ruby]
senthil has joined #ruby
PragCypher has joined #ruby
kevinbond has joined #ruby
Drewch has joined #ruby
iamjarvo has joined #ruby
kaneda__ has joined #ruby
LBRapid has joined #ruby
tobago has joined #ruby
BigJasonWebb has joined #ruby
maletor has joined #ruby
vju has joined #ruby
kaneda has joined #ruby
CheeToS has joined #ruby
ZachBeta has joined #ruby
savage- has joined #ruby
sdwrage has joined #ruby
blueadept has joined #ruby
s0ber has joined #ruby
y3llow has joined #ruby
zakwilson_ has joined #ruby
Deesl has joined #ruby
_ack has joined #ruby
seanstickle has quit [#ruby]
ZachBeta has joined #ruby
wracoon has joined #ruby
jarred has joined #ruby
fayimora has joined #ruby
ananthakumaran has joined #ruby
artm has joined #ruby
Drewch has joined #ruby
cha1tanya has joined #ruby
pdtpatr1ck has joined #ruby
shruggar has joined #ruby
sdwrage has joined #ruby
nytfox has joined #ruby
<becom33> shevy: :)
fully_human has joined #ruby
Guest35671 has joined #ruby
jnraine has joined #ruby
jnraine has quit [#ruby]
havenn has joined #ruby
NeV3rKilL has joined #ruby
wallerdev has joined #ruby
rpgsimmaster has joined #ruby
adamkittelson has joined #ruby
sand1 has joined #ruby
mbriggs has joined #ruby
<fully_human> Hello. I'm trying to install rvm. I get to the step "bash <(wget -qO- https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) stable" but I get an error saying "mkdir: cannot create directory `/usr/share/ruby-rvm': Permission denied" Anyone know what's wrong?
<shevy> yo
kaneda__ has joined #ruby
<shevy> becom33, I am googling "how to make a gem" again :D
wallerdev has joined #ruby
<shevy> I tried 4 times before to make a gem, but the projects always were too complicated
sako has joined #ruby
<shevy> I never figured out how to distribute yaml files with a gem so far
<mbriggs> fully_human: did you put sudo in front of the command?
NeV3rKilL has joined #ruby
<mbriggs> fully_human: it looks like its trying to run as root and do a system install
<fully_human> mbriggs: No, because if I do I have a whole host of problems later on. Is it supposed to be run as root?
<mbriggs> fully_human: not unless you are running it on a server
bayashi__ has quit ["Leaving..."]
<mbriggs> fully_human: i would open a bug
<shevy> fully_human well you lack permissions to open /usr/share/ruby-rvm I suppose. you can ask the #rvm guys too
<mbriggs> fully_human: it looks like it thinks its running as root even though it isnt
sdwrage has joined #ruby
<fully_human> I know what it means...I've been using LInux long enough to know about permissions. :)
<mbriggs> fully_human: yeah, ask on #rvm
nikhgupta has joined #ruby
fayimora has joined #ruby
NeV3rKilL has joined #ruby
atmosx has joined #ruby
eldariof has joined #ruby
rpgsimmaster has joined #ruby
jankly has joined #ruby
fully_human has quit ["Leaving"]
ph^ has joined #ruby
kaneda__ has joined #ruby
shtirlic has joined #ruby
IrishGringo has joined #ruby
axl_ has joined #ruby
blueadept has joined #ruby
Blaster has joined #ruby
lobak has joined #ruby
<pyreal> shevy: http://intridea.com/blog/2012/3/8/polishing-rubies-part-i 4 part series .. how to make a gem using bundler
kstephens has joined #ruby
simpleharmonicmo has joined #ruby
dagnachewa has joined #ruby
genxweb has joined #ruby
samuelkadolph has joined #ruby
lipiec has joined #ruby
andynu has joined #ruby
lipiec has quit [#ruby]
TheMoonMaster has joined #ruby
ringotwo has joined #ruby
<shevy> hmm
<shevy> bundler never worked for me so far
<apeiros_> hu?
<apeiros_> how come? it's rather easy to use…
<becom33> shevy: sheeeeeeeeeeeeevvvvvvvvvvvvvvvyyyyyyyyyyyyy
<pyreal> shevy: i used almost exactly the same process to build a gem last weekend.. only saw the article after i had it done, but it's almost step for step what i did
rpgsimmaster_ has joined #ruby
maletor has joined #ruby
sand1 has joined #ruby
io_syl has joined #ruby
wtfisgoingon has joined #ruby
davidpk has joined #ruby
<shevy> hehe so you didnt build with bundler? :)
mikeycgto has joined #ruby
mikeycgto has joined #ruby
<becom33> shevy: I was waiting till you come
<any-key> that's what she said?
<shevy> wat
<shevy> you need to make your brain the best teacher
<shevy> brain + practice
<any-key> brainpractice is best practice
<pyreal> shevy: yes i built with the rake tasks provided by the bundler bootstrap… releasing gem is as easy as rake release
imapickle has joined #ruby
mdw has joined #ruby
rpgsimmaster has joined #ruby
atmosx has joined #ruby
sand1 has joined #ruby
ZachBeta has joined #ruby
kevinbond has joined #ruby
kaneda has joined #ruby
Jay_Levitt has joined #ruby
yannis has joined #ruby
lunchdump has joined #ruby
rpgsimmaster_ has joined #ruby
sand1 has joined #ruby
basdfasdf has joined #ruby
buschhardt has quit [#ruby]
Drewch has joined #ruby
<becom33> http://pastebin.com/vguceSSx in here how can I get those DETAIL hash values in to two arrays ?
maletor has joined #ruby
<becom33> priviously I need a wrong paste . this is the correct paste http://pastebin.com/aFdUGANH
<shevy> becom33 namespace kicks in again
rpgsimmaster has joined #ruby
<shevy> DETAIL is only available in Test
<shevy> so to scope to it, you have to do what?
<shevy> :)
<shevy> come on man
<shevy> these are basics
ed_hz_ has joined #ruby
<shevy> becom33 heeeeeello
Guest47110 has joined #ruby
maletor has joined #ruby
Clordio_ has joined #ruby
<shevy> :(
<n3m> is there a convention how to write gem names with more than one word? As one (lowercase) word, CamelCase, separated with a hyphen/underscore?
<becom33> hey shevy
<becom33> sorry I was trying somthing
<becom33> shevy: from that point what should I do ?
buschhardt has joined #ruby
<becom33> elo are you there shevy ?
wallerdev has joined #ruby
<shevy> first, the DETAIL what is this
<shevy> yeah
<shevy> DETAIL <--- what is this
<becom33> Hash name right ?
fayimora_ has joined #ruby
<shevy> in this case it is a hash
<shevy> but in general, what is it
<becom33> are you asking the perpose its having >
<becom33> ?
<shevy> no, what it is
<shevy> it has a name
<becom33> having that ** llol english
<shevy> DETAIL SOMETHING THIS THAT
<shevy> ^^^
<becom33> umm I dnno :/
Nss has joined #ruby
<shevy> ok, it took you too long, it is a constant
<shevy> now, to namespace
<shevy> this DETAIL constant resides in a namespace
<shevy> can you tell me in which namespace it resides, in your pastie example?
<senthil> n3m: snake case is prob the best option, though i forget to follow it often
<becom33> @detail ?
<shevy> no no no
<shevy> what is @detail man
fayimora_ has joined #ruby
<shevy> the name
<shevy> come on man! :(
<shevy> what is @foo
<shevy> there are only 10 terms you need to know in ruby
<shevy> this is one
<becom33> a variable
<shevy> good!
<becom33> local variable I guesss
<shevy> what kind of variable though?
<shevy> no!
<becom33> globle comes as $
<shevy> detail
<shevy> ^^^ this would be local
<shevy> yes, global would be $detail
<shevy> but @detail is not like a local variable
<becom33> den
<shevy> what
<shevy> @foo is an instance variable
<shevy> @@foo is a class variable but forget these, they suck
<shevy> ok but you still have not answered the question
<becom33> instent ?
<shevy> you have DETAIL yes?
<shevy> instance variable
<shevy> remember that word
<shevy> now to DETAIL
<becom33> damn I was writing that
<becom33> lol
<shevy> you see it resides ... where?
<shevy> where does DETAIL reside?
<becom33> I dnno what you mean by reside
<shevy> where can you find it
<shevy> where is is situated
senthil has joined #ruby
<becom33> outside the method
<shevy> yes
<shevy> exactly
<shevy> but still, does it reside inside anything?
<becom33> also inside initialize method
<shevy> no no no
<shevy> not DETAIL
<shevy> @detail yes but I speak about DETAIL
<shevy> ok, let's hury up
jmfcool has joined #ruby
<shevy> DETAIL resides in the namespace of class Test
maletor has joined #ruby
<shevy> now, the question is:
<shevy> How do you scope to DETAIL?
fayimora_ has quit ["Leaving..."]
<shevy> how do you access it
<becom33> Test::Detail ?
<becom33> DETAIL *
<shevy> hehe
<becom33> :/
<shevy> yes
<becom33> no ?
<shevy> Test::DETAIL
<becom33> lol lucky guess :P
<shevy> you corrected your mistake, so that works
<shevy> it would work if Test is a module as well
<shevy> module Test; DETAIL = blablabla
<shevy> Test::DETAIL
<shevy> ok, now you know how to scope to it
<shevy> now, you must decide how to proceed from here
schovi has joined #ruby
<shevy> you could put DETAIL outside any class
<shevy> you could put it into its own file and require that
<becom33> shevy: the problem is how can Include this files in the readfile.rb ?
<shevy> we already have our method
<shevy> via Dir[]
<shevy> you could make a new file too
<shevy> next to readfile.rb, you could create constants.rb
<becom33> yes but does it include that to the class ?
<shevy> and collect all constants in that file
<shevy> well, your classes would have to require that file
<shevy> so you would have to do require 'constants.rb' at the top
<becom33> no no I mean we've done
<becom33> @list = Dir ['core/**/*.rb']
mdw_ has joined #ruby
<shevy> dont put a ' '
<shevy> @list = Dir['core/**/*.rb'
<becom33> so now I need to get this files into the readfile
<shevy> the file, sure
<shevy> it is just a require
<shevy> you forgot to require those files btw
<shevy> you must use require or load
<shevy> you dont do that here
<shevy> you just stop at:
<shevy> pp @list
<shevy> ah
<shevy> does this output the proper files btw?
<shevy> if so, you can use require
<shevy> run that file, then change it to:
<shevy> @list.each {|file| require file }
<becom33> ahh wait lemme try that
<shevy> but make sure that @list is correct
<shevy> that is why there is the pp there
<shevy> pp @list
<shevy> to give you output you can look at
<shevy> to compare if it has the right files
<becom33> shevy: Im gettign rubytwo/filetwo.rb:7: warning: already initialized constant DETAIL
<shevy> it is a very primitive way to "debug" :)
<shevy> yeah
<shevy> you redefine class Test in the second file
<shevy> I still dont know why you do :P
<shevy> you could rename the second constant
<shevy> like, DETAIL1 and DETAIL2
<shevy> and put it into constants.rb, but that is all up to you
<shevy> you also dont have to use constants either
jeane has joined #ruby
<shevy> this is not the important part!
<becom33> sorry shevy I cant :/ the thing is . the file1.rb file2.rb must have a stucture
<shevy> eh
<becom33> DETAIL is having a structure of name and detail .
<shevy> I still dont get it
<shevy> :)
<shevy> why dont you just extend readfile.rb
<shevy> and pass in the different formats?
<shevy> Test.new(DETAIL1)
<shevy> Test.new(DETAIL2)
<shevy> and you could store DETAIL1 DETAIL2 in readfile.rb
<shevy> (or put it into a .rb file and require that, that is the same)
snearch has joined #ruby
<shevy> hmm I must leave again for some minutes, sorry. play around with the code a bit, require the other .rb files
yoklov has joined #ruby
becom33 has joined #ruby
<becom33> umm hello ?
luke--_ has joined #ruby
maletor has joined #ruby
becom33 has joined #ruby
<becom33> shevy: I got disconnected . did u say anything after my request ?
gomix has joined #ruby
havenn has joined #ruby
maloik has joined #ruby
d2dchat has joined #ruby
jeane has quit [#ruby]
<becom33> umm shevy ?
sdwrage has joined #ruby
Squarepy has joined #ruby
<senthil> becom33: he left
Squarepy has joined #ruby
io_syl has joined #ruby
carlyle has joined #ruby
jonteru has joined #ruby
twinturbo has joined #ruby
d3c has joined #ruby
bawer has joined #ruby
ghostlines__ has joined #ruby
choffstein has joined #ruby
dfamorato has joined #ruby
Indian has joined #ruby
_null has joined #ruby
n3m has joined #ruby
sbanwart has joined #ruby
_null has joined #ruby
_null has joined #ruby
_null has joined #ruby
fowl has joined #ruby
ringotwo has joined #ruby
<shevy> becom33 yeah not sure if you saw anything
<shevy> oh he left too
<fowl> he did not want to be a vessel for your truth shevy
Faris has joined #ruby
fayimora has joined #ruby
<shevy> fowl you know the sickest videos :P
Russell^^ has joined #ruby
<fowl> shevy that's from a wonderful show called wonder showzen
<shevy> first time I read that
ghostlines_ has joined #ruby
shadoi has joined #ruby
Clordio_ has joined #ruby
davidcelis has joined #ruby
chimkan has joined #ruby
nyuszika7h has joined #ruby
mrwalker has joined #ruby
wroathe has joined #ruby
<wroathe> How do you turn a string into a constant?
<wroathe> like 'A' => A
<senthil> wroathe: active_support has #constantize
stephenjudkins has joined #ruby
<yxhuvud> Module::const_get
<wroathe> Thanks yxhuvud
<senthil> that won't work for "::"
<shevy> _ = Object.const_get "bar".upcase'
<wroathe> Thanks guys :)
<yxhuvud> senthil: right, you will actually have to do it in the right context.
<apeiros_> i.e., to get Foo::Bar, you do Foo.const_get('Bar')
<apeiros_> or: Object.const_get('Foo').const_get('Bar')
luckyruby has joined #ruby
<shevy> cool
<shevy> never saw .const_get chained before
mengu has joined #ruby
cobragoat has joined #ruby
RobbieAB has quit [#ruby]
iamjarvo has joined #ruby
falkoner has joined #ruby
dbgster has joined #ruby
<wroathe> What about if I'm doing something like this ['a', 'b', 'c'].map! { |el| Object.const_get el }
<wroathe> Currently I get NameErrors
<wroathe> Whoops
mdw has joined #ruby
<wroathe> What about if I'm doing something like this ['a', 'b', 'c'].map! { |el| Object.const_get el.upcase }
<wroathe> That's what I meant
<fowl> what about it
<wroathe> It doesn't work. I get NameErrors
<shevy> better NameErrors than PantErrors
<fowl> why wroathe
<wroathe> Actually nvm
<fowl> A = B = C = true; ['a', 'b', 'c'].map! {|el| Object.const_get el.upcase }
<apeiros_> wroathe: so? the constants you want don't exist…
havenn has joined #ruby
<wroathe> I get unitialized constant A
<fowl> works fine here
<apeiros_> wroathe: where do you set A?
<apeiros_> remember, if you set it in a namespace, it's not Object::A
<apeiros_> ::A is guaranteed to be Object::A
<wroathe> Maybe I'm not understanding this right? Do I have to initialize a constant before I can use that?
JNZ has joined #ruby
<apeiros_> of course!
<apeiros_> what should it return if it doesn't exist?
<fowl> wroathe you cant 'get' a constant if it doesnt exist silly
<wroathe> That's the thing. I was wondering how to initialize a constant from a string
<apeiros_> (ok, ivars & globals autovivify - constants, class-vars and lvars don't)
<wroathe> If that's even possible
<apeiros_> const_set
<fowl> you dont want to do that
<wroathe> Basically I was hoping to do this
<fowl> having dynamically named constants is dumb and not useful
<apeiros_> but it sounds a bit like you were abusing the variable system as a hash
<klip> lol
<wroathe> ['a', 'b', 'c'].map! { |el| Object.const_set el.upcase } => [A, B, C]
<apeiros_> that doesn't raise? I'd expect const_set to require 2 args…
<wroathe> I'm just practicing theory right now. I'd never do this in practice.
<wroathe> I haven't tested it
RBK_ has joined #ruby
friskd has joined #ruby
<wroathe> Consider the above to be pseudocde
<wroathe> pseucode
<apeiros_> wroathe: erm, yeah, no. won't work.
<wroathe> pseudocode*
<apeiros_> you have to set the constant to a value.
<apeiros_> and since it is a constant, it should be *the* value.
<apeiros_> otherwise, *don't use a constant*.
<apeiros_> (constant in ruby means that it will always reference the same object, technically this can be circumvented, but shouldn't. it doesn't mean that the object it references is immutable, though)
pyreal has joined #ruby
<wroathe> In theory I was trying to initialize those constants and then loop through that array and initialize classes from those new constants
<wroathe> But, again, that would defeat the purpose of constants.
<wroathe> I'm moreso just messing around with irb right now.
<apeiros_> you know that a class doesn't need to be referenced by a constant, right?
<wroathe> Meaning?
<wroathe> I thought a class with assigned to a specific constant at all times
<apeiros_> my_classes = [Struct.new(:a, :b), Class.new, Class.new(Foo::Bar)] # <-- valid, the array contains 3 classes, none referenced by any constant
<wroathe> Ahh
SphericalCow has joined #ruby
<wroathe> apeiros_: Thanks :)
<apeiros_> x = my_classes.first.new("value for a", "value for b")
<apeiros_> classes are objects
<RBK_> I am a beginner in ruby . i am using <%= error_messages_for(:album)%>
<RBK_> but its giving error "undefined method `custom_error_messages"
<RBK_> does this method exists in ruby ?
<wroathe> RBK #ror
<senthil> RBK_: that's rails helper method
<shevy> RBK_ if it was defined somewhere
<apeiros_> their only 2 specialities are: a) they can be instanciated, b) they can host/contain instance methods
<wroathe> This is the ruby channel, you're looking for the #ror channel
waseem_ has joined #ruby
<senthil> prob. ActionView
<RBK_> ok
<wroathe> Also, I don't believe you can reference AR objects in templates with symbols
<wroathe> error_messages_for(@album) if you've got @album in your controller action somewhere
<wroathe> Correct me if I'm wrong (not saying it's impossible, just that typically you use either local or instance variables)
<wroathe> apeiros_: I think I knew that, I just keep on forgetting that technically everything in Ruby is an object
<apeiros_> not everything. but almost.
<wroathe> So in my mind I keep glorifying classes as something special
<apeiros_> they are
<apeiros_> I even specified their speciality ;-)
<apeiros_> though, one of them they don't get from Class but from Module
<wroathe> Technically you can instantiate an object with object.dup
ghanima has joined #ruby
<apeiros_> that's not instanciation
<apeiros_> the class of the duplicated object is the same as the originals
<apeiros_> if it was instancation, then object.dup.class == object
dgynn has joined #ruby
<RBK_> @ wroathe : its giving the same error .. using @album ..
<RBK_> actually i want to use tht method for my database :album
<wroathe> error_messages_for is expecting an active record object of some kind
<wroathe> And from what I gathered you're trying to use it in a template
<wroathe> So you need to have access to that specific object
waxjar has joined #ruby
Blaster has joined #ruby
<wroathe> If you're trying to get access to that object's error messages you can do something like @object.errors.full_messages.each do |err|
yannis has joined #ruby
welliwanttobe has joined #ruby
nikhgupta has joined #ruby
<wroathe> Also, error_messages_for is apparently deprecated in favor of that syntax I just used.
kesor_ has joined #ruby
<apeiros_> also, this is still a rails topic in #ruby…
<wroathe> true. I wanted him to leave but I settled for helping him :P
<wroathe> Guess I shouldn't feed the troll
<apeiros_> he's a troll? (I didn't follow the discussion)
<wroathe> I was using it more metaphorically to say that I shouldn't feed into his questions as he'll keep coming back for more (much like I've been doing over the last half hour)
fubhy has quit [#ruby]
<shevy> yah man hey
<shevy> if you help em all here
<shevy> they dont have an incentive to go to #rubyonrails :(
<shevy> wroathe your punishment shall be YOU MUST FOLLOW #rubyonrails FOR TWO HOURS
cynthiak has joined #ruby
<wroathe> That shouldn't be too difficult as #rubyonrails is basically an empty channel :) #ror is the one you're looking for.
yannis_ has joined #ruby
SphericalCow has joined #ruby
SphericalCow has joined #ruby
<cynthiak> Hi, have a method that takes in a String Argument, however, just the first string it read by the method, the rest are ignored
<cynthiak> how do i correct this?
<cynthiak> "This is sample"
<wroathe> that question doesn't make sense
<wroathe> Post code imo
mdw has joined #ruby
<apeiros_> cynthiak: there's something missing
<wroathe> That should work fine
<apeiros_> if you try that method yourself in irb, you'll see that what you say ain't true
<wroathe> Also, use << instead of +
<cynthiak> Ok,let me try that
<shevy> cynthiak what means "first string it read by the method"
<shevy> what is the first string
<apeiros_> it won't change anything. as said, what you experience doesn't happen in the code you pasted.
<cynthiak> Still get's just the first String with <<
<wroathe> I know it won't change anything
<wroathe> That wasn't a fix
<wroathe> It's an optimization
<wroathe> + instantiates a new string from the two
<apeiros_> cynthiak: your terminology is wrong also, "This is title" is *one* string, there is no "first string" in that. you mean the first word of the string.
<fowl> apeiros_ do you think that anybody whos ever came in here looking for rails help actually read the topic and go to #rubyonrails
stringoO has joined #ruby
<cynthiak> yes, the first word in the String
<apeiros_> fowl: we'll never no, since those never would have asked
<apeiros_> never *know
<delinquentme> getting the name of a file from within that file?
<apeiros_> __FILE__
<apeiros_> assuming you mean *ruby* file
<apeiros_> but hey, nowadays, we don't have to be specific in our questions, for irc'ers can read yer mind!
<shevy> cynthiak see now things become CLEARER
<delinquentme> YESSSSS
<delinquentme> not __self__
<fowl> dear god no
<shevy> cynthiak "abc def ghi".split(' ')[0] # => "abc"
<fowl> not __self__
<apeiros_> that's so pythonic…
<apeiros_> shevy: na, that's the reverse of his issue
<shevy> I just thought I got it this time
<shevy> :(
<wroathe> Cynthiak that should work as you intend it to
<apeiros_> wroathe: btw., I'd rather use #{} than <<
<wroathe> That's true.
<wroathe> Either way it works.
<wroathe> I usually prefer << if I'm truly appending a string to another string
<wroathe> Which in this case he is.
<wroathe> cynthiak: Did that solve your problem?
<apeiros_> key is where/how he's using it. it's there where it happens.
bluOxigen has joined #ruby
bluOxigen has joined #ruby
<wroathe> Yeah, we're missing information here.
<wroathe> Because what he's got should work.
<apeiros_> correct
<fowl> class String; def >>(str) str << self end end
<fowl> :p
<apeiros_> foul!
<wroathe> Your point being that ruby is awesome and lets you create a prepend operator?
<fowl> wroathe no..my goal in life is to write the most confusing ugly code possible
ales has joined #ruby
<fowl> i'm the dr frankenstein of ruby
<wroathe> That's why I like sabotaging teams by adding def <|>(*args) to random built in classes and using them all over my code.
<cynthiak> Havent been able to achieve it, updated my gist to show how i use it
sqbell has joined #ruby
<wroathe> Re-link gist
<wroathe> too lazy to scroll
<wroathe> Because nothing says fuck you like 3 <|> 4
<fowl> eh
<fowl> what is <|>
<apeiros_> cynthiak: invalid html
<wroathe> Yeah
<wroathe> Seriously
<wroathe> Think about what m is actually returning
<wroathe> And how it needs to be formatted in html
<wroathe> fowl: You see my point.
<wroathe> Step 1 of confusing ruby
<wroathe> Inventing your own operators.
<fowl> k well code has to be valid or its of no use to anybody
<fowl> you dont have a point silly
<wroathe> Your right.
<wroathe> I don't have a point :(
<cynthiak> apeiros_: mind pointing out the error in it?
<fowl> i got a project for you
<apeiros_> cynthiak: "<li data-original-title=this is my title>"
<apeiros_> that's what you emit
<apeiros_> the only value belonging to the attribute 'data-original-title' is 'this'. the rest are flags of their own.
<wroathe> in this case <|> would just be [self, args.first][(rand * 2).to_i]
<apeiros_> quote your attribute data.
<fowl> wroathe if you poke around you'll find the 1.9 version
<fowl> its on a branch of a fork or something
<wroathe> Whoops, my math on that rand was an epic fail.
stephenjudkins has joined #ruby
h4mz1d has joined #ruby
bwlang has joined #ruby
<cynthiak> apeiros_: Thanks, fixed it
zunnyohno has joined #ruby
<fayimora> Do you guys think Ruby is easier to pick up compared to Python?
twinturbo has joined #ruby
<shevy> fayimora depends
<shevy> you can use only a small subset of ruby
<fayimora> :(
<shevy> then the answer would be yes
<shevy> but I think ruby as a whole is more complex than python
kevinbond has joined #ruby
<fayimora> Oh ok understandable
<shevy> it's partly because of the philosphoy. there is more than one way to do it also includes creative thinking
kevinbond_ has joined #ruby
<Norrin> for that reason, i think python vibes with my learning process better. i'll do whichever one gets me a higher salary though
<shevy> hehe
<shevy> enter the PHP
<Norrin> because of rails, i'm basically looking into ruby. because rails seems so much more dominate than django
<arturaz> i'd disagree
<arturaz> as knowing both python and ruby
<arturaz> i'd say that ruby just felt a lot more natural to me
<arturaz> I usually could just write ruby code and it would work
<arturaz> whereas with python I always had to consult with the docs
<CrazyPickles> Ruby is just the coolest visual ever made in programming
<CrazyPickles> ontop of the great little gems
<CrazyPickles> I'm an addict an obession over languages like this
cobragoat has joined #ruby
wilmoore has joined #ruby
<shevy> I cant stand some decisions in python
<shevy> explicit self is one
<CrazyPickles> Python is amazing <3
<CrazyPickles> its like the snakest beast of programming I love python so much god I'm such a fan
<shevy> you like every language anyway
<CrazyPickles> I know lopl
<CrazyPickles> I know*
<CrazyPickles> I try to like every language as much as possible <3
<shevy> I dont have a strong hate against requiring indent ... but from a purity point of view, I really dont think programming languages should care about indent at all. that a program refuses to run with the wrong indent, really sucks from this point of view
<apeiros_> shevy: so you don't like haml?
<apeiros_> or yaml?
<apeiros_> s/or/and/
<shevy> well I dont program in yaml
<shevy> I already hate that wrong indents cause yaml to choke :(
<CrazyPickles> what a stupid name for programming language tho
<CrazyPickles> I think I don't like yaml
<shevy> it is better than XML
<CrazyPickles> maybe I like it more now lol
<CrazyPickles> so what do you use to make guis in ruby shevy?
<CrazyPickles> I use WxRuby
<wroathe> Requiring indent is actually an amazing way to teach beginning programmers to respect whitespace.
<wroathe> Honestly if I ever am in the position where I need to teach beginners my craft I'd use Python.
<CrazyPickles> ahh I guess I would teach them the basic foundation of C++ then let them explore it
<shevy> CrazyPickles, still mostly ruby-gtk
<CrazyPickles> gtk you use linux <3
thone_ has joined #ruby
<CrazyPickles> I'm on gayindows :P
<shevy> wroathe, you dont think it feels dirty that a highly sophisticated language REQUIRES indent to make sense of itself?
<shevy> CrazyPickles, but ruby-gtk works on windows too
<shevy> I know because my ruby-gtk things work on windows
<shevy> for the most part
<shevy> windows sucks indeed
<CrazyPickles> Oh :P I shall take alook then I love gui's
<shevy> but it is not total suckage
<wroathe> I have a variety of thoughts on this topic but my core thing is that first and foremost your role as an educator is to get people excited about this industry.
<CrazyPickles> Oh gtk is very nice
<wroathe> C++ has a high barrier to entry
jbw has joined #ruby
<CrazyPickles> window = Gtk::window.new(gtk::WINDOW_TOPLEVEL)
<CrazyPickles> C++ is the biggest pain in the world to start on but thats what programming is at its core pain
<wroathe> Sure. That lesson is valuable but in order of precedence I think getting excited should come before feeling pain.
<CrazyPickles> I agree in some ways :)
<CrazyPickles> is there a way to use win32 in ruby?
<wroathe> Because feeling pain immediately will strip away all but the most dedicated (which can be good and bad)
<CrazyPickles> but isn't that what the programming people want
<shevy> wroathe hehe you are thinking tactically, I like that :D
<CrazyPickles> people who are capable of going through the hardships of programming
<shevy> yes
<shevy> Java
<CrazyPickles> I think boths sides win in some ways
<CrazyPickles> its about balancing them both
<shevy> wroathe, for me it was the matz philosophy that won me over
<wroathe> But at the beginning of your programming career (or potential career) you and everyone else aren't in a position to decide whether or not you'll be a good programmer.
<CrazyPickles> I dabbled in php and ruby then went into c++ personally
<wroathe> So dragging them through an intense gauntlet is a good way to lose potentially GREAT programmers.
<CrazyPickles> thats true in minors ways
<CrazyPickles> minor*
<wroathe> That will never ever return to the practice because of their first bad experience.
<wroathe> SO your role as an educator should be, "HEY, look at how EXCITING this can be." before "HEY, lets talk about efficiency differences between compiled and interpreted languages"
<apeiros_> ze funk!
<CrazyPickles> hmm balance them both you win both ways :)
<wroathe> Education is not really concurrent Crazy :)
<wroathe> You have to learn a before you can get to b
<CrazyPickles> then innovation must come ! :D
<shevy> I think CrazyPickles is really crazy
<CrazyPickles> I actually am lol apprently alot of people say I am ;(
wmoxam has joined #ruby
<shevy> if we ever are in desperate war, we have to call him
<wroathe> I like this guy. He's got a good stink eye.
<shevy> it would be a win-win. it cant get worse, but it could get better :)
<wroathe> We'll need that in a vicious cock fight
<shevy> haha
<CrazyPickles> I would sit there and talk it out then fight it out as much as possible who likes a fight really?
adamkittelson has joined #ruby
<wroathe> shevy: What do you mean about the Matz philosophy?
artm has joined #ruby
<wroathe> For me my learning path went C++ -> HTML/CSS -> Javascript -> PHP -> Python -> Ruby
banjara has joined #ruby
<wroathe> I suspect it will eventually circle back into C++ someday.
cynthiak has quit [#ruby]
banjara has quit [#ruby]
<shevy> wroathe, that a programming language should try to make programmers happy, and that happy programmers should try to make people happy
<shevy> I never ever had this with i.e. Java or PHP
Foxandxss has joined #ruby
<wroathe> The thing is that that doesn't have to just be a Ruby thing. You can teach C++ or Java in a fun way.
<wroathe> And you can use either to make fun things.
<CrazyPickles> trying to get another type of irc client this one sucks so many shades of leaf
<shevy> wroathe, even the best teacher goes only so far to make up for deficiencies of any language
Imapickle has joined #ruby
<wroathe> Well I think the best way to go about teaching advanced topics is to present the why and the how before the way.
<wroathe> Get people excited about what it could be used for before diving into theory.
<wroathe> before the what*
<wroathe> now the way*
<wroathe> not the way*
<wroathe> wow I fail today
<wroathe> on so many levels
dfamorato has joined #ruby
<CrazyPickles> someone say something?
<CrazyPickles> testing out irc client colours
<CrazyPickles> ahh nvm fixed it :)
fbernier has joined #ruby
sdwrage_ has joined #ruby
dbgster has joined #ruby
<fowl> wroathe did you check out superators
Chryson has joined #ruby
prometheus has joined #ruby
apok has joined #ruby
ph^ has joined #ruby
cloke has joined #ruby
lkba has joined #ruby
MrGando has joined #ruby
PragCypher has joined #ruby
n1x has joined #ruby
Foxandxss has joined #ruby
mdw has joined #ruby
delinquentme has joined #ruby
davidcelis has joined #ruby
forest| has joined #ruby
chessguy has joined #ruby
mythmon has joined #ruby
web0 has joined #ruby
mdw has joined #ruby
Sailias has joined #ruby
td123 has joined #ruby
<delinquentme> what ruby tool can I use to check for headers from a webpage ? Im trying to verify that pages are XML formatted
wroathe has joined #ruby
forest| has joined #ruby
looopy has joined #ruby
<apeiros_> net/http
jgrevich has joined #ruby
jgrevich has joined #ruby
xsdg has joined #ruby
jgrevich_ has joined #ruby
jgrevich_ has joined #ruby
bricker881 has joined #ruby
rdegraci has joined #ruby
rdegraci has quit [#ruby]
rushed has joined #ruby
srnty has joined #ruby
<delinquentme> how does the &operation work in ruby?
<fowl> delinquentme: do you know how to define a method that takes a block like def foo(a,b, &block) ?
<delinquentme> ... no .. but it looks like you just showed me? =]
<fowl> thats only half of it tho
lewis1711 has joined #ruby
<delinquentme> oh
<delinquentme> nope .. this is a unary? operator?
<fowl> when you call a method like fun_time &something ruby will expect `something` to be a proc/lambda
<fowl> now, if it isn't a proc/lambda ruby will try to call #to_proc on it
<wroathe> ["Fowl's Mother"].to_proc
<wroathe> That's right. I went there.
<fowl> once again with the invalid code
<fowl> thats ok tho wroathe i still love you
<wroathe> You're invalid code.
<wroathe> <3
<fowl> here's an Array#to_proc implementation you can look at https://gist.github.com/2238869
<wroathe> Lame.
pyreal has joined #ruby
sohocoke has joined #ruby
davidcelis has joined #ruby
igotnolegs has joined #ruby
<delinquentme> how long shoulg I put off learning to_proc
<delinquentme> probs not huh
<fowl> delinquentme all you really need to know is that [1,2,3,4].map &:to_s is just short for [1,2,3,4].map { |x| x.to_s }
<delinquentme> @_@
<delinquentme> fowl
<delinquentme> THAT is elegant
<fowl> lol
<Mon_Ouie> Actually it's more like { |recv, *args| recv.to_s(*args) }
carlyle has joined #ruby
<fowl> how do you pass args that way Mon_Ouie
cobragoat has joined #ruby
<Mon_Ouie> Well, you need a method that passes more than one argument to its block
<Mon_Ouie> e.g. #each_with_index, but that one isn't really useful
<Mon_Ouie> It's useful with inject, but then you can just pass the symbol right away
<Mon_Ouie> ([1, 2, 3].inject(&:+) wouldn't work if arguments weren't passed over)
rTypo has joined #ruby
<yxhuvud> should suffice to iterate over something nested eg [[1,2], [3,4]]
keymone_ has joined #ruby
<Mon_Ouie> I tried that, it doesn't seem to work
<Mon_Ouie> Makes sense, though, you don't want arrays that contain arrays to be a special case
mikos has joined #ruby
<yxhuvud> good point
Nisstyre has joined #ruby
daniel_hinojosa has joined #ruby
srnty has joined #ruby
nfluxx has joined #ruby
<apeiros_> ruby-1.9.2-p290:026:0>> {20 => 2, 255 => 16}.map_pair(&:to_s)
<apeiros_> # => ["10100", "ff"]
<apeiros_> (I cheated - class Hash; def map_pair; map { |a| yield(*a) }; end; end)
EXCHGR has joined #ruby
<delinquentme> DRY? http://pastie.org/3705967
<delinquentme> more dry
* delinquentme starts dryer
<fowl> thats pretty ez to dry out
<apeiros_> you failed
<apeiros_> 2011 is in twice, 2010 is missing
<delinquentme> yeah you get the idea :D
<delinquentme> and then test that all values are true
<delinquentme> or !false
srnty has joined #ruby
<apeiros_> all you need in the array is the year.
<fowl> i hope that's not how you check for a match in nokogiri
<fowl> if so thats some ugly stuff <_<
<apeiros_> using `.class ==` is fail anyway
<apeiros_> .is_a?
<delinquentme> why is that?
<delinquentme> i was trying out a few ways to test those
<delinquentme> .is_a? is another option that i used elsewhere :D
<apeiros_> or rather, .instance_of?, if you don't accept descendants as valid
kvirani has joined #ruby
Nisstyre has joined #ruby
<delinquentme> soooo
<delinquentme> the drying?
<apeiros_> I think I told you?
<apeiros_> not obvious enough?
<fowl> here's a hint
<fowl> nvm
<fowl> im not giving out hints today
Faris has joined #ruby
pac1 has joined #ruby
<shevy> lol
<apeiros_> foul!
<fowl> lol
cobragoat has joined #ruby
<fowl> well..if it was me..since the only thing that changes in the 4 array items is the year, so i'd iterate on that with (2009..2012).map { build your expression here }
carlyle has joined #ruby
Vert has joined #ruby
<fowl> but then you have to run 2011 twice and skip 2010 so its probably not worth it
forest| has joined #ruby
<delinquentme> i like the ()
<delinquentme> and map
iocor has joined #ruby
syamajala has joined #ruby
CheeToS has joined #ruby
syamajala has joined #ruby
startling has joined #ruby
* davidcelis prepares himself for a murder most fowl
<wroathe> I get it.
<apeiros_> fowl: if 2010 really should be in twice, just use an array instead of a range
<apeiros_> it's not like 4 4 digits ints would make for a huge array…
<fowl> apeiros_ i was just saying that because of the first example
<apeiros_> smaller than his current one anyway…
<fowl> er his pastebin or whatever
<shevy> is it size comparison time again
<apeiros_> shevy: no, golf time
<apeiros_> what's your handicap?
<shevy> it's right in front of me
<davidcelis> ಠ_ಠ
robotmay has joined #ruby
lewis1711 has quit [#ruby]
mikos has joined #ruby
startling has quit [#ruby]
<rTypo> for a newbie, should i consider using Apache or Thin for a ruby web server?
<rTypo> if this can/should be answered ~easily
<rTypo> i'm starting a medium sized project while learning ruby. so only if the server matters
<davidcelis> rTypo: I've had good luck with thin
<davidcelis> rTypo: You might also want to check out puma
<rTypo> great. it's nice to escape from apache a bit and learn some other server
fixl has joined #ruby
<rTypo> should be a fairly scallable web application in the end
<apeiros_> rTypo: thin works easily with a rackup file. apache is a bit more to configure, but still reasonably simple. depends a bit on your aims and requirements.
<apeiros_> using rack, you don't have to care much for the webserver anyway. you can change it any time.
<rTypo> that would be my purpose
<rTypo> i have to focus on the app more
<apeiros_> then use rack.
<davidcelis> To be honest, I have no info on the scalability of thin or puma
<davidcelis> I know that the more popular choices for production environments are apach2/passenger, or nginx/unicorn
<davidcelis> I haven't really heard of a production Ruby web app using a standalone server rather than a wrapper/interface to a more established web server like apache or nginx
<apeiros_> you can run your app on a wide range of servers with it
* apeiros_ uses a standalone drb server for some things
mcwise has joined #ruby
<apeiros_> it's not exposed to heavy load, though. not yet at least.
<rTypo> davidcelis: it's not for a production env, but for my faculty graduation
<rTypo> so i'm more flexible with the choice'
<fowl> use sinatra then
<rTypo> fowl: i'm a bit scared of frameworks since i'm doing something a bit unusual, and i tried to learn RoR a few days
<fowl> to hell with rails
<rTypo> ... and i failed to see how i'll use RoR and gave up (though i liked it)
<rTypo> yeah, but i'm afraid to spend too much time on learning a framework. i'm a bit late already
Clordio_ has joined #ruby
<rTypo> apeiros_: thanks, it seems like i'll use rack
sdwrage has joined #ruby
<apeiros_> rTypo: you can pick up sinatra in a couple of minutes. at least the basics. rack is quite on the metal (easy to understand too, though)
<rTypo> apeiros_: isn't it too hard to do something unconventional with a framework (esp. for a newbie)
<rTypo> i mean, i have exp in learning languages, but not frameworks
<rTypo> i can build an app with a new language
<apeiros_> depends. but yes, that's possible.
<apeiros_> on the metal, you can do about anything you want.
<rTypo> i'll check sinatra too. i'll try it one day and see how it works
<rTypo> but i still like to know everything underneath (college student, eh.. :D)
<apeiros_> sure. rack is nice. and as said, easy enough.
<rTypo> great
<rTypo> this should be fun (that's why i picked ruby amongst other languages)
<rTypo> having too much options (anything, really) was so stressful
<apeiros_> I mean, the minimal rack app looks something like: proc { |env| [200, {"content-type" => "text/plain"}, ["Hello World!"]] }
<apeiros_> meh, misses the run
<rTypo> i'll go with rack for the server interface
<rTypo> i'll also check sinatra tomorrow
<rTypo> and start reading a ruby book
<gogiel> anyone recommend good json serializator/builder?
<wroathe> multi-json?
basdfasdf has joined #ruby
<rTypo> apeiros_: sorry. now i've read again. picking up sinatra in minutes? hmm...
<rTypo> then how is sinatra compared to rails?
<rTypo> in terms of learning
<rTypo> because rails seemd pretty complex for me to do crazy things with it (couple of days of learning)
mikeric has joined #ruby
<wroathe> That would be a better question for #ror
<rTypo> i'm trying to figure out if i have enough time to learn sinatra (~3 mo to finish the project)
<wroathe> And I'm trying to direct you to #ror
<rTypo> sorry, i was writing
<apeiros_> rTypo: rails is largely opinionated software. i.e., it prescribes a set path. follow it and you gain a ton of tools and pre-done things
<rTypo> wroathe: you're right. i'll ask them tomorrow after i check sinatra
<apeiros_> it comes at the price of having to learn and understand that set path
<rTypo> apeiros_: yes, i got that feeling too
<apeiros_> sinatra has a very easy & quick start. it doesn't provide you with such richly pre-done things.
<apeiros_> with it too, you'll have to work harder the further you deviate from the norm
<rTypo> that's a risk to consider
<rTypo> depends on my specific app from now on
<rTypo> i'll check and see how it goes
<rTypo> apeiros_: thanks for the help
<apeiros_> I think you can hook a plain rack-app into a sinatra app
<apeiros_> you can for sure hook a rack-app anywhere within your rack-app (sinatra is a rack-app)
<apeiros_> so there's also always the option of doing some hybrid. sinatra for the easy, standard stuff, metal for the freaky non-standard things
d2dchat has joined #ruby
<rTypo> that's nice! it alleviates the risk of stalling mid-way with sinatra
choffstein has joined #ruby
Banistergalaxy has joined #ruby
zunnyohno has joined #ruby
vitoravelino has joined #ruby
Faris1 has joined #ruby
JNZ has joined #ruby
wroathe has joined #ruby
<gogiel> is it possible to see which method is exectued at runtime? i try to find which to_json method my application uses
<apeiros_> method(:to_json)
<apeiros_> in 1.9, Method has quite a couple of introspective methods in it (sadly no #source)
<apeiros_> especially .owner and .source_location are of interest
Faris has joined #ruby
jrhorn424 has joined #ruby