Topic for #ruby is now Ruby programming language || ruby-lang.org || RUBY SUMMER OF CODE! rubysoc.org/ || Paste >3 lines of text in http://pastie.org || Para a nossa audiencia em portugues http://ruby-br.org/
dcarper [dcarper!~Adium@c-76-125-233-64.hsd1.pa.comcast.net] has joined #ruby
ColinT [ColinT!~ColinT@69-11-97-130.regn.static.sasknet.sk.ca] has joined #ruby
tvw [tvw!~tv@e176006132.adsl.alicedsl.de] has joined #ruby
mmokrysz [mmokrysz!~mmokrysz@pdpc/supporter/student/mmokrysz] has joined #ruby
<heoa>
[params['post']['toWhom'], params['post']['issue']] <--- some structures, have to investigate the data types
berserkr [berserkr!~david@212.122.111.205.dyn.user.ono.com] has joined #ruby
<heoa>
I checked with puts that it returns the correct but it apparently returns in wrong data type
<apeiros_>
puts is not a suitable tool to inspect datastructures.
<apeiros_>
also, you're horrible at describing both, your problem and what you want
<apeiros_>
you did not answer my question ("returns none"), you did not state what "the err" is, you did not state what datastructure you got, you did not state what datastructure you expected, you did not state upon what input that happened
<apeiros_>
that's quite a lot of gaping holes…
<heoa>
apeiros_: 'returns none' was false statement
<heoa>
err is
<heoa>
checked it with puts
<apeiros_>
"it"…
<heoa>
...now searching for command to check the data structures, new with ruby...
<apeiros_>
p obj
<blueadept>
what's a good way of cycling through two variables in a loop?
<apeiros_>
or: puts obj.inspect
<blueadept>
like pass 1 is var1, pass 2 is var2, pass3 is var1, pass4 is var2
<blueadept>
set the variable again right before the loop ends?
<blueadept>
hm, that wont work
<apeiros_>
blueadept: what are you trying to achieve?
<blueadept>
trying to set a class for a row
<blueadept>
like row 1 is grey, row 2 is white, row 3 is grey, row 4 is white
<apeiros_>
blueadept: rails?
<blueadept>
wait i think i got it
<blueadept>
% 2
_debo [_debo!~marco.deb@cpc18-enfi16-2-0-cust743.hari.cable.virginmedia.com] has joined #ruby
QaDeS [QaDeS!~mklaus@frbg-5d84f61c.pool.mediaWays.net] has joined #ruby
Sailias [Sailias!~jonathan@CPE0018f85e576d-CM001bd7aaaf96.cpe.net.cable.rogers.com] has joined #ruby
r0bby_ [r0bby_!~wakawaka@guifications/user/r0bby] has joined #ruby
jimmy1980 [jimmy1980!~jimmy@112.224.2.116] has joined #ruby
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
vitoravelino [vitoravelino!~rockhampt@unaffiliated/vtr] has joined #ruby
akem [akem!~akem@156.236.84.79.rev.sfr.net] has joined #ruby
akem [akem!~akem@unaffiliated/akem] has joined #ruby
Pip [Pip!~Pip@host-85-156-66-217.spbmts.ru] has joined #ruby
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby
etdebruin [etdebruin!~luclouvre@ip68-101-242-65.sd.sd.cox.net] has joined #ruby
mickn [mickn!~mickn@unaffiliated/mickn] has joined #ruby
kaktus [kaktus!~kaktus@tyr.rstack.cc] has quit [#ruby]
jimmy1980 [jimmy1980!~jimmy@112.224.2.116] has joined #ruby
<heoa>
puts("#tyhmaah"+params['post']['issue']) does not run when params returns nothing, why?
<heoa>
"#tyhmaah"+[] <--- it works but the last one does not. So the last one must be something odd, investigating..
<apeiros_>
heoa: puts prints, it doesn't return. also, as I said before, puts is a bad tool to inspect, use obj.inspect or p
<apeiros_>
e.g.: p params['post']['issue']
<apeiros_>
also, "#tyhmaah"+[] most certainly does *not* work.
<apeiros_>
(unless you redefined String#+, which I hope you did not…)
ggtoo [ggtoo!~ggtoo@122.178.0.116] has joined #ruby
asdfgbdes [asdfgbdes!birds@151.83.73.83] has joined #ruby
_debo [_debo!~marco.deb@cpc18-enfi16-2-0-cust743.hari.cable.virginmedia.com] has joined #ruby
dagnachewa [dagnachewa!~dagnachew@modemcable142.238-179-173.mc.videotron.ca] has joined #ruby
apeiros_ [apeiros_!~apeiros@77-58-115-24.dclient.hispeed.ch] has joined #ruby
jetblack [jetblack!~jetblack@99-32-20-118.uvs.evtnil.sbcglobal.net] has joined #ruby
jbrokc [jbrokc!~jbrokc@c-98-228-139-230.hsd1.il.comcast.net] has joined #ruby
<jbrokc>
is there a cool way to shorten var files = %w[app/modules/*.rb app/fixtures/*.rb app/helpers/*.rb] or that is, make the 'app/' part not repeat between each entry in the array (yet still be added as the value)
QaDeS_ [QaDeS_!~mklaus@frbg-5d84e0e6.pool.mediaWays.net] has joined #ruby
tvw [tvw!~tv@e176007247.adsl.alicedsl.de] has joined #ruby
Targen [Targen!~iguana@190.39.181.108] has joined #ruby
kennethreitz [kennethreitz!~kennethre@c-24-127-96-129.hsd1.va.comcast.net] has joined #ruby
jimmy1980 [jimmy1980!~jimmy@112.224.2.116] has joined #ruby
<WhiteHorse>
does anyone have statistics about the usage of ruby vs python?
<DeeJayTwo>
When we're talking about a ruby method...
<DeeJayTwo>
I often see Class#method notation...
<DeeJayTwo>
is it the standard way or is it possible to refer to it as Class.method ?
<DeeJayTwo>
has the # a special meaning?
<samuelkadolph>
DeeJayTwo: # usually means an instance method
<samuelkadolph>
DeeJayTwo: So it would be Class.new.method and not Class.method
<DeeJayTwo>
I see
<DeeJayTwo>
class.method would be some kind of static method ?
<samuelkadolph>
Class.method would be a class method on Class
<DeeJayTwo>
ok
<DeeJayTwo>
Thank you for the "clarification"
dbgster_ [dbgster_!~dbgster@CPE0013f7b7170c-CM0013f7b71708.cpe.net.cable.rogers.com] has joined #ruby
jbrokc [jbrokc!~jbrokc@c-98-228-139-230.hsd1.il.comcast.net] has quit [#ruby]
Taos [Taos!~jakob@host-92-20-152-142.as13285.net] has quit [#ruby]
JakeyChan [JakeyChan!~JakeyChan@ec2-175-41-238-53.ap-northeast-1.compute.amazonaws.com] has joined #ruby
<DeeJayTwo>
Do I understand that when I can call a method ending with a ?, it means it returns a boolean?
jimmy1980 [jimmy1980!~jimmy@112.224.2.116] has joined #ruby
burgestrand [burgestrand!~burgestra@h-163-174.a155.priv.bahnhof.se] has joined #ruby
JakeyChan_ [JakeyChan_!~JakeyChan@114.92.5.127] has joined #ruby
dagnachewa [dagnachewa!~dagnachew@modemcable142.238-179-173.mc.videotron.ca] has joined #ruby
<dagnachewa>
gem install sciruby
<dagnachewa>
Building native extensions. This could take a while...
<dagnachewa>
ERROR: Error installing sciruby:
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby
<dagnachewa>
ERROR: Failed to build gem native extension.
<WhiteHorse>
after installing rubygems i do: gem -v I get this:
<WhiteHorse>
F:\Ruby192\bin\ruby.exe: No such file or directory -- /f/Ruby192/bin/gem (LoadError)
techhelp [techhelp!~Dan@ip70-162-129-93.ph.ph.cox.net] has joined #ruby
<nclx>
banisterfiend: so include is for instance methods and extend is for class methods?
<banisterfiend>
nclx: include brings the modules methods in as instance methods, yes, and extend brings the modules methods in as class method
<banisterfiend>
however, the class methods defined on the module itself -- a la: module M; def self.hello; end; end are completely inaccessible to the class that includes/extends it
jonathanrwallace [jonathanrwallace!~jonathanr@99-11-165-168.lightspeed.tukrga.sbcglobal.net] has joined #ruby
p1d [p1d!~p1d@dslb-088-064-144-058.pools.arcor-ip.net] has joined #ruby
jimmy1980 [jimmy1980!~jimmy@112.224.2.9] has joined #ruby
kennethreitz [kennethreitz!~kennethre@c-24-127-96-129.hsd1.va.comcast.net] has joined #ruby
tyman [tyman!~tyman@173-12-219-189-Fresno.hfc.comcastbusiness.net] has joined #ruby
twogateproxy [twogateproxy!~twogatepr@173-228-28-38.dsl.dynamic.sonic.net] has joined #ruby
<twogateproxy>
Hi, anybody know why this just hangs for me? imap = Net::IMAP.new('imap.gmail.com')
failshell [failshell!~failshell@modemcable237.159-58-74.mc.videotron.ca] has joined #ruby
nanoyak [nanoyak!~nanoyak@adsl-69-110-22-115.dsl.pltn13.pacbell.net] has joined #ruby
<failshell>
Im using the following file in sinatra. but during the post, if the variable is empty, it goes straight to sleep, and never goes to the other view. any idea how to fix it? https://github.com/failshell/columbo/blob/master/app.rb
Sliker [Sliker!~ponies@117.163.pn.adsl.brightview.com] has joined #ruby
rvmeier [rvmeier!~rodrigo@pc-136-172-241-201.cm.vtr.net] has joined #ruby
brweber2 [brweber2!~brweber2@ip68-100-25-226.dc.dc.cox.net] has joined #ruby
Mohan [Mohan!~nixh0st@unaffiliated/mohan] has joined #ruby
CppIsWeird [CppIsWeird!~user@pool-96-248-209-239.nrflva.fios.verizon.net] has joined #ruby
NinoScript [NinoScript!~Adium@pc-55-124-83-200.cm.vtr.net] has joined #ruby
tyler [tyler!~tyman@173-12-219-189-Fresno.hfc.comcastbusiness.net] has joined #ruby
kennethreitz [kennethreitz!~kennethre@c-24-127-96-129.hsd1.va.comcast.net] has joined #ruby
h4mz1d [h4mz1d!~hamfz@c-69-244-5-169.hsd1.al.comcast.net] has joined #ruby
s14 [s14!~nick@ool-18b934ee.dyn.optonline.net] has joined #ruby
raythecat [raythecat!~raythecat@cpe-66-27-147-33.socal.res.rr.com] has joined #ruby
Targen [Targen!~iguana@190.39.181.108] has joined #ruby
failshell [failshell!~failshell@modemcable237.159-58-74.mc.videotron.ca] has quit ["Leaving"]
jimmy1980 [jimmy1980!~jimmy@112.224.2.9] has joined #ruby
samuelk|away [samuelk|away!~samuelkad@unaffiliated/samuelkadolph] has joined #ruby
perryh_ [perryh_!~root@far3567.urh.uiuc.edu] has joined #ruby
perryh_ [perryh_!~root@unaffiliated/perry753] has joined #ruby
mikepack [mikepack!~mikepack@c-174-51-77-22.hsd1.co.comcast.net] has joined #ruby
igotnolegs [igotnolegs!~igotnoleg@174-27-220-21.slkc.qwest.net] has joined #ruby
saschaheylik [saschaheylik!~sascha@80-121-34-26.adsl.highway.telekom.at] has joined #ruby
wmoxam_ [wmoxam_!~wmoxam@69-196-129-140.dsl.teksavvy.com] has joined #ruby
NinoScript [NinoScript!~Adium@pc-55-124-83-200.cm.vtr.net] has quit [#ruby]
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby
apucacao [apucacao!~apucacao@S0106602ad075859e.vc.shawcable.net] has joined #ruby
rpowell [rpowell!~rpowell@CPE-121-217-11-112.lnse1.cht.bigpond.net.au] has joined #ruby
Draco_ [Draco_!~draco@dsl-69-171-130-117.acanac.net] has joined #ruby
LittleBill902 [LittleBill902!smith@c-71-197-103-184.hsd1.ca.comcast.net] has joined #ruby
nanoyak [nanoyak!~nanoyak@173-228-119-246.dsl.dynamic.sonic.net] has joined #ruby
frogstarr78 [frogstarr78!~frogstarr@lan.viviotech.net] has joined #ruby
Cyrus [Cyrus!~Cyrus@cpe-173-173-106-235.satx.res.rr.com] has joined #ruby
Cyrus [Cyrus!~Cyrus@unaffiliated/cyrus] has joined #ruby
eldariof [eldariof!~CLD@81.200.24.179] has joined #ruby
jrist-afk [jrist-afk!~jrist@184-96-215-133.hlrn.qwest.net] has joined #ruby
ghosTM55 [ghosTM55!~user@li279-245.members.linode.com] has joined #ruby
wedgeV [wedgeV!~wedge@cpe-68-173-18-241.nyc.res.rr.com] has joined #ruby
raythecat [raythecat!~raythecat@cpe-66-27-147-33.socal.res.rr.com] has joined #ruby
Cyrus_ [Cyrus_!~Cyrus@cpe-173-173-106-235.satx.res.rr.com] has joined #ruby
Cyrus [Cyrus!~Cyrus@unaffiliated/cyrus] has joined #ruby
haiwu [haiwu!~haiwu@c-24-12-72-214.hsd1.il.comcast.net] has joined #ruby
Skaag [Skaag!~skaag@107.58.238.186] has joined #ruby
Guest84839 [Guest84839!~root@c-24-12-72-214.hsd1.il.comcast.net] has joined #ruby
rippa [rippa!~rippa@109-161-74-125.pppoe.yaroslavl.ru] has joined #ruby
qKer^ [qKer^!~qker@61.227.38.86.ip.erdves.lt] has joined #ruby
qKer^ [qKer^!~qker@61.227.38.86.ip.erdves.lt] has quit [#ruby]
PhilK [PhilK!~PhilK@2001:470:1f05:c99:21f:d0ff:fe84:e3ca] has joined #ruby
xpot [xpot!~xpot@166-70-100-198.ip.xmission.com] has joined #ruby
jimmy1980 [jimmy1980!~jimmy@112.224.2.9] has joined #ruby
maletor [maletor!~maletor@c-69-181-28-195.hsd1.ca.comcast.net] has joined #ruby
mxweas_ [mxweas_!~max@c-24-7-45-147.hsd1.ca.comcast.net] has joined #ruby
Amirh [Amirh!~amir@2.181.24.15] has joined #ruby
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has quit [#ruby]
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has joined #ruby
asQuirreL [asQuirreL!~amenon@93-96-10-147.zone4.bethere.co.uk] has joined #ruby
elliot98 [elliot98!~elliot@77.125.7.231] has joined #ruby
elliot98 [elliot98!~elliot@unaffiliated/elliot98] has joined #ruby
Tuxist [Tuxist!~quassel@host-091-097-109-095.ewe-ip-backbone.de] has joined #ruby
ggtoo [ggtoo!~ggtoo@122.164.89.24] has joined #ruby
Seisatsu [Seisatsu!~seisatsu@2001:5c0:1000:a::a1] has joined #ruby
manizzle [manizzle!~manizzle@adsl-99-102-133-31.dsl.pltn13.sbcglobal.net] has joined #ruby
Cervajz [Cervajz!~Cervajz@opensuse/member/Cervajz] has joined #ruby
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby
stayarrr [stayarrr!~olivererx@dslb-178-009-059-241.pools.arcor-ip.net] has joined #ruby
looopy [looopy!~looopy@pool-141-156-48-174.washdc.btas.verizon.net] has joined #ruby
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
Asher [Asher!~asher@98.158.127.150] has joined #ruby
smgt [smgt!~simon@76.156.216.81.static.m-dp.siw.siwnet.net] has joined #ruby
ph^ [ph^!~ph^@cm-84.212.225.74.getinternet.no] has joined #ruby
lkba [lkba!~AndChat@aaqo61.neoplus.adsl.tpnet.pl] has joined #ruby
mxweas_ [mxweas_!~max@c-24-7-45-147.hsd1.ca.comcast.net] has joined #ruby
altivec_ [altivec_!~altivec@46.191.235.89] has joined #ruby
yxhuvud [yxhuvud!mongo@h-17-224.a149.priv.bahnhof.se] has joined #ruby
ghosTM55 [ghosTM55!~user@li279-245.members.linode.com] has joined #ruby
NinoScript [NinoScript!~Adium@pc-55-124-83-200.cm.vtr.net] has joined #ruby
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby
TheTFEF [TheTFEF!JS@cpe-173-88-110-115.columbus.res.rr.com] has joined #ruby
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby
apok [apok!~apok@96.24.67.22] has joined #ruby
jimmy1980 [jimmy1980!~jimmy@112.224.2.9] has joined #ruby
bosphorus [bosphorus!~bosphorus@85.96.60.119] has joined #ruby
asQuirreL [asQuirreL!~amenon@93-96-10-147.zone4.bethere.co.uk] has joined #ruby
pantsman [pantsman!~pantsman@2.25.208.217] has joined #ruby
pantsman [pantsman!~pantsman@pdpc/supporter/active/pantsman] has joined #ruby
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby
dr_bob [dr_bob!~dr_bob@p5DC4F7B7.dip.t-dialin.net] has joined #ruby
mxweas_ [mxweas_!~max@c-24-7-45-147.hsd1.ca.comcast.net] has joined #ruby
MrCheetoDust [MrCheetoDust!~farhankha@cpe-76-94-123-32.socal.res.rr.com] has joined #ruby
apeiros_ [apeiros_!~apeiros@77-58-115-24.dclient.hispeed.ch] has joined #ruby
RomD [RomD!~Roman@nrbg-d932340b.pool.mediaWays.net] has joined #ruby
frode15243 [frode15243!~frode1524@pdpc/supporter/active/frode15243] has joined #ruby
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby
tvo [tvo!~tvo@5354CF57.cm-6-5d.dynamic.ziggo.nl] has joined #ruby
tvo [tvo!~tvo@katapult/developer/tvo] has joined #ruby
catphish [catphish!~charlie@2001:9d8:2005:12::3] has joined #ruby
<catphish>
does #finalize get called automatically? and if so, when?
<apeiros_>
catphish: automatically. undetermined.
<catphish>
undetermined?
<apeiros_>
it can be at any time or not at all.
<catphish>
ok, not enormously useful then>
<catphish>
*?
<catphish>
what would cause it to get run? an instance being detected during a GC?
<apeiros_>
I think using finalizers is generally discouraged for that reason
<apeiros_>
theoretically they'd be invoked upon GC
<catphish>
ok
jimmy1980 [jimmy1980!~jimmy@112.224.3.99] has joined #ruby
<catphish>
someone's written one in a library to close a tcp connection, but it basically never gets called
<catphish>
so using the code in a web app simply caused an increasing number of connections
<catphish>
i'll rework it to do something sane
<apeiros_>
hm, useless I think. afaik ruby closes connections on its own upon GC anyway.
<catphish>
it's not a ruby socket connection, its in a FFI library, which is why they added
<catphish>
it, but it doesn't work well
<apeiros_>
ah
<catphish>
will just rewrite my app to close it manually
<catphish>
i tried making it persist, but thats not reliable enough
<catphish>
and in this case the establishment time is negligible
<catphish>
thanks :)
fermo [fermo!~fermo@ppp-94-29.26-151.libero.it] has joined #ruby
Amirh [Amirh!~amir@2.181.24.15] has joined #ruby
Cervajz [Cervajz!~Cervajz@opensuse/member/Cervajz] has joined #ruby
Jrz [Jrz!~jrz@d152222.upc-d.chello.nl] has joined #ruby
Marcio [Marcio!~Marcio@80.251.169.199] has joined #ruby
ph^ [ph^!~ph^@cm-84.212.225.74.getinternet.no] has joined #ruby
apok [apok!~apok@96.24.67.22] has joined #ruby
<shevy>
dumdedum
looopy [looopy!~looopy@pool-141-156-48-174.washdc.btas.verizon.net] has joined #ruby
p0y [p0y!~p0y@121.97.59.227] has joined #ruby
Pip [Pip!~Pip@host-87-156-66-217.spbmts.ru] has joined #ruby
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby
Hellojere [Hellojere!~Hellojere@89.7.90.160] has joined #ruby
RichGuk [RichGuk!~RichGuk@carina.27smiles.com] has joined #ruby
ChampS_ [ChampS_!~ChampS@p57953654.dip.t-dialin.net] has joined #ruby
_debo [_debo!~marco.deb@cpc18-enfi16-2-0-cust743.hari.cable.virginmedia.com] has joined #ruby
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
Manhose [Manhose!~Manhose@bl18-45-1.dsl.telepac.pt] has joined #ruby
ikaros [ikaros!~ikaros@dslb-084-059-073-057.pools.arcor-ip.net] has joined #ruby
<shevy>
ok so let's collect wisdom
<shevy>
what are good ways to avoid bugs?
jgrimes [jgrimes!~jg@cpe-071-070-140-012.nc.res.rr.com] has joined #ruby
niklasb [niklasb!~codeslay0@p5B3115CA.dip0.t-ipconnect.de] has joined #ruby
<musee>
don't write code
jgrimes [jgrimes!~jg@cpe-071-070-140-012.nc.res.rr.com] has joined #ruby
<apeiros_>
pretend they're features (aka "the MS way")
<musee>
lol
rushed [rushed!~rushed@cpe-70-116-11-35.austin.res.rr.com] has quit [#ruby]
jgrimes [jgrimes!~jg@cpe-071-070-140-012.nc.res.rr.com] has joined #ruby
jgrimes [jgrimes!~jg@cpe-071-070-140-012.nc.res.rr.com] has joined #ruby
<shevy>
hmm
<shevy>
no no no
<shevy>
I need better ways
fridim_ [fridim_!~fridim@2a01:e35:2ece:f2d0:223:4eff:fe6c:c754] has joined #ruby
<Asher>
use unit tests to do behavior-based development and ensure that your existing code works as expected
<Mon_Ouie>
Assume you have a method def square(x); x + x; end — your test suite indicate this works: assert_equal square(2), 4
<shevy>
hmm unit test
<shevy>
that's the first suggestion I can see being potentially good
<Mon_Ouie>
But you notice it fails in some special cases like x = 1, just do this: if x == 1; 1; else; x + x;end
<shevy>
that sounds very bad
<shevy>
that sounds like "add one bug to fix another bug"
<shevy>
Asher, I am going to use unit tests from now on
mmokrysz [mmokrysz!~mmokrysz@pdpc/supporter/student/mmokrysz] has joined #ruby
<Asher>
once you learn how to write tests as part of the process of development you will never turn back
<Asher>
it reduces so much insanity by proving that your code still does what you think
<banisterfiend>
Asher: do you write tests first
<shevy>
yeah sometimes my code surprises me
<shevy>
especially when I wrote it years ago
<Asher>
banisterfiend - no i diagram and write descriptions of what i want to achieve, lay out the module/class hierarchy and interfaces, sketch out a basic implementation, then write tests to prove that my implementation does what i planned before i move on to other steps
<Asher>
i find that writing tests first is too low-level to help me think about my implementation
looopy [looopy!~looopy@pool-141-156-48-174.washdc.btas.verizon.net] has joined #ruby
<Asher>
but i think about design in terms of interface dynamics
<banisterfiend>
i write a mixture of test first/test after
<Asher>
so i lay out the interface dynamics first
<banisterfiend>
i might implement some features first, then write tests for them, then in the process of writing the tests for the code that exists i may write a few other tests for code that i haven't yet written
<Asher>
then i write tests per file outside of the context they're used
<Asher>
and i often go back and rewrite the tests later
<banisterfiend>
Asher: what testing lib do u use
Morkel [Morkel!~Morkel@xdsl-87-78-205-136.netcologne.de] has joined #ruby
<Asher>
rspec but only b/c that's the only one i've seen a decent textmate bundle for
<Asher>
eventually i will use something more appropriate than rspec
Clooth [Clooth!~Clooth@193-64-22-91-nat.elisa-mobile.fi] has joined #ruby
JakeyChan [JakeyChan!~JakeyChan@180.172.203.109] has joined #ruby
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
tvw [tvw!~tv@e176007247.adsl.alicedsl.de] has joined #ruby
<Asher>
i tend to work on code in large strokes and then use the tests to hone in on details
p0y [p0y!~p0y@121.97.59.227] has joined #ruby
jgrimes [jgrimes!~jg@cpe-071-070-140-012.nc.res.rr.com] has joined #ruby
Telling [Telling!Telling@do.it.and.undo.it] has joined #ruby
jgrimes [jgrimes!~jg@cpe-071-070-140-012.nc.res.rr.com] has joined #ruby
<catphish>
shevy: the best way to avoid bugs IMO is to try to think of bugs in every line you write and test them mentall
<Asher>
that turns into spaghetti pretty quickly
apok [apok!~apok@96.24.67.22] has joined #ruby
<catphish>
i think through everything before writing it
<Asher>
eventually you will write an application big enough you can't think it all at once
<catphish>
but if you can't do that, unit tests i guess
<Asher>
i'm certainly not discouraging trying to think through all of it :)
<catphish>
of course small methods are good
<catphish>
everything can be tested individually
<Asher>
small methods make testing easier too
Pip [Pip!~Pip@host-87-156-66-217.spbmts.ru] has joined #ruby
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby
<banisterfiend>
small methods + small classes + a pure heart
<banisterfiend>
but you want want everything too open and airy
<apeiros>
KISS & normalization are a great way to keep bugs out too
<Asher>
open and airy?
<banisterfiend>
you want some nooks and crannies in your code, Mon_Ouie also keeps an area of his code particularly complicated and whenever he visits it it evokes feelings of a dusty hallway with an old fashioned green telephone
<Asher>
hahah
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
<shevy>
I wanna see a screencast of Mon_Ouie coding
Hellojere [Hellojere!~Hellojere@89.7.90.160] has joined #ruby
chilversc [chilversc!~chris@about/csharp/regular/KeeperOfTheSoul] has joined #ruby
marvelous [marvelous!~batman@g224228038.adsl.alicedsl.de] has joined #ruby
<banisterfiend>
i love the theorizing at the end of that article too
<rippa>
maybe you also put space after unary minus?
<banisterfiend>
. "Young students tend to use it when they get together," Abdelli-Beruh says. "Maybe this is a social link between members of a group."
<Asher>
no i hadn't heard of that
Russell^^ [Russell^^!~Russell^^@88.97.51.87] has joined #ruby
burgestrand [burgestrand!~burgestra@h-163-174.a155.priv.bahnhof.se] has joined #ruby
S2kx [S2kx!~S1kx@ip-95-223-80-198.unitymediagroup.de] has joined #ruby
johnduhart [johnduhart!~quassel@46.105.138.12] has joined #ruby
<chilversc>
installing using rvm, why is it not compiling zlib support when I have zlib installed through yum?
jimmy1980 [jimmy1980!~jimmy@112.224.3.99] has joined #ruby
heoa [heoa!~xyz@fik5.kyla.fi] has joined #ruby
<shevy>
hmm
<shevy>
when I do
<shevy>
MY_DATA = File.readlines('some/data.dat')
<shevy>
it is read the moment when the parser sees it?
jensn [jensn!~Jens@206-244-96-87.cust.blixtvik.se] has joined #ruby
<shevy>
or only when it is actually needed
<heoa>
xtableWiseRuby2HTML(Dir.glob('*')) -- something like this aronud?
<shevy>
right now I have it in a method, without constant, but I want to also shift that data around as string constant, so I am considering moving it to CONSTANTS instead. but those files can be fairly huge ...
bwlang [bwlang!~anonymous@static-71-245-233-146.bstnma.fios.verizon.net] has joined #ruby
johnduhart [johnduhart!~quassel@46.105.138.12] has joined #ruby
_debo [_debo!~marco.deb@cpc18-enfi16-2-0-cust743.hari.cable.virginmedia.com] has joined #ruby
<heoa>
Is there something like R Sweave for ruby for creating dynamic content?
Morkel [Morkel!~Morkel@xdsl-87-78-205-136.netcologne.de] has joined #ruby
<apeiros>
shevy: ruby is single pass, so yes, parsing and executing there are the same, unless it's within a method definition or a proc
<shevy>
okies
<apeiros>
chilversc: either because you don't have the zlib headers or the headers aren't anywhere where rvm looks for them
catphish [catphish!~charlie@2001:9d8:2005:12::3] has quit ["Leaving"]
<chilversc>
ah yeah, seems zlib-devel isn't there
kirun [kirun!~kirun@78-86-154-194.zone2.bethere.co.uk] has joined #ruby
techhelp [techhelp!~Dan@ip70-162-10-229.ph.ph.cox.net] has joined #ruby
johnduhart [johnduhart!~quassel@46.105.138.12] has joined #ruby
araujo [araujo!~araujo@gentoo/developer/araujo] has joined #ruby
jensn_ [jensn_!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby
thoraxe [thoraxe!~thoraxe@50-73-95-6-static.hfc.comcastbusiness.net] has joined #ruby
Faris [Faris!~faris@41.140.27.158] has joined #ruby
timonv [timonv!~timonv@140pc227.sshunet.nl] has joined #ruby
ert1999 [ert1999!~mIRCita01@31.188.80.49] has joined #ruby
<ert1999>
salve
<ert1999>
!list
ert1999 [ert1999!~mIRCita01@31.188.80.49] has quit [#ruby]
jimmy1980 [jimmy1980!~jimmy@112.224.3.99] has joined #ruby
smgt [smgt!~simon@76.156.216.81.static.m-dp.siw.siwnet.net] has joined #ruby
jacobrelkin [jacobrelkin!~jacobrelk@c-98-248-93-35.hsd1.ca.comcast.net] has joined #ruby
jacobrelkin [jacobrelkin!~jacobrelk@c-98-248-93-35.hsd1.ca.comcast.net] has joined #ruby
dcarper [dcarper!~Adium@c-76-125-233-64.hsd1.pa.comcast.net] has joined #ruby
gayasentinel [gayasentinel!~gayasenti@de.real-vpn.com] has joined #ruby
sepp2k [sepp2k!~sexy@g224099114.adsl.alicedsl.de] has joined #ruby
idle` [idle`!~idle@jem75-5-82-244-52-176.fbx.proxad.net] has joined #ruby
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby
warris [warris!~warris@ACBB091B.ipt.aol.com] has joined #ruby
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
jimmy1980 [jimmy1980!~jimmy@112.224.3.99] has joined #ruby
IrishGringo [IrishGringo!~chatzilla@c-71-229-99-200.hsd1.fl.comcast.net] has joined #ruby
mickn [mickn!~mickn@unaffiliated/mickn] has joined #ruby
LBRapid [LBRapid!~LBRapid@66-44-32-34.c3-0.129-ubr1.lnh-129.md.cable.rcn.com] has joined #ruby
zxiest [zxiest!~zxiest@213.204.69.188] has joined #ruby
<zxiest>
Hello everybody =)
<zxiest>
Any recommendations on asynchronous calls?
warris [warris!~warris@ACBB091B.ipt.aol.com] has quit [#ruby]
eigar [eigar!~eigar@244.80-203-38.nextgentel.com] has joined #ruby
Adman65 [Adman65!~Adman65@d141221.adsl.hansenet.de] has joined #ruby
ghosTM55 [ghosTM55!~user@li279-245.members.linode.com] has joined #ruby
Faris [Faris!~faris@41.140.27.158] has joined #ruby
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has joined #ruby
negaduck [negaduck!~negaduck@213.141.130.13] has joined #ruby
atmosx [atmosx!~atmosx@191.116.broadband5.iol.cz] has joined #ruby
gayasentinel [gayasentinel!~gayasenti@de.real-vpn.com] has joined #ruby
flip_digits [flip_digits!~textual@c-71-199-243-97.hsd1.fl.comcast.net] has joined #ruby
perlsyntax [perlsyntax!~perlsynta@unaffiliated/perlsyntax] has joined #ruby
fahadsadah [fahadsadah!fahad@unaffiliated/fahadsadah] has joined #ruby
Jrz [Jrz!~jrz@d152222.upc-d.chello.nl] has joined #ruby
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby
ggtoo [ggtoo!~ggtoo@122.164.89.24] has joined #ruby
<JakeyChan>
what's "task" used for in ruby ?
<apeiros>
JakeyChan: not a ruby core method
<apeiros>
you're probably looking at a rakefile?
<JakeyChan>
yeah
<JakeyChan>
learning
<JakeyChan>
task: test do
<apeiros>
task :test do ;-)
<apeiros>
defines a rake task
shevy [shevy!~shevy@178-191-240-112.adsl.highway.telekom.at] has joined #ruby
<JakeyChan>
ok
<apeiros>
(or adds dependencies to an existing task)
<JakeyChan>
got it, sounds simple
Coty91 [Coty91!~coty@96-32-145-105.dhcp.gwnt.ga.charter.com] has joined #ruby
<JakeyChan>
I am newer of ruby :)D
<JakeyChan>
:)
ixti [ixti!~ixti@251.Red-88-25-53.staticIP.rima-tde.net] has joined #ruby
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby
<JakeyChan>
ruby syntax looks not easy
<JakeyChan>
like that
<JakeyChan>
end or raise "Failures"
<apeiros>
o0
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby
<JakeyChan>
there are three command
<JakeyChan>
end
<JakeyChan>
or
<JakeyChan>
raise
<JakeyChan>
complex ?
<apeiros>
expression or expression
<JakeyChan>
but how it works?
<apeiros>
the `end` probably belongs to a block
<shevy>
end closes your block
<shevy>
raise raises an exception
<shevy>
but you can live without exceptions for some time
<apeiros>
if the block returns a falsish value (nil or false), raise "Failures" will be invoked
<shevy>
but not without end!
<apeiros>
I'd argue that you're looking at bad code, though
<JakeyChan>
when raise the exception ? forever execute this block code ?
<shevy>
when an error happens
<apeiros>
false or raise "foo" # <-- raises
<shevy>
begin
<shevy>
5 / 0
<JakeyChan>
no, I am reading rails source
<shevy>
rescue Exception => error
<apeiros>
true or raise "foo" # <-- does not raise
<shevy>
puts "Someone did something bad here."
<shevy>
end
<apeiros>
JakeyChan: assumption confirmed then :-p
<shevy>
haha
dbgster [dbgster!~dbgster@CPE0013f7b7170c-CM0013f7b71708.cpe.net.cable.rogers.com] has joined #ruby
<apeiros>
I would not consider rails source code to be an example of good coding practices (except for the vast test coverage)
<shevy>
apeiros, didn't you want to write your own web framework once?
<shevy>
or was that only manveru
<apeiros>
shevy: I still want. but not enough time.
<apeiros>
manveru did - ramaze is his
<shevy>
I see
<shevy>
yeah
<apeiros>
now I'm doing stupid things like implementing prefix matching in C…
<JakeyChan>
;)
fritzthecat_ [fritzthecat_!~fritzthec@HSI-KBW-078-043-029-162.hsi4.kabel-badenwuerttemberg.de] has joined #ruby
<shevy>
ewwww C
<Tasser>
apeiros, no libs around?
negaduck_ [negaduck_!~negaduck@213.141.130.13] has joined #ruby
<apeiros>
Tasser: didn't bother much to search
<apeiros>
I still want to improve my C knowledge, so small projects like this are great
<Tasser>
write python, compile to C ;-)
<apeiros>
besides memory management, there's little I can do wrong
<apeiros>
yeah, that helps a lot with learning C of course…
<apeiros>
(writing python and compiling to C…)
joast [joast!~rick@76.178.187.164] has joined #ruby
<JakeyChan>
I just need you, guys, to explain this code :)
<JakeyChan>
root :to => 'home#index'
<JakeyChan>
:to is method ?
<JakeyChan>
=> is method too ?
<apeiros>
no
<JakeyChan>
:O
<apeiros>
`root :to => 'home#index'` is syntax sugar for `root({:to => 'home#index'})`
<apeiros>
{:to => 'home#index'}.class # => Hash
<apeiros>
:to.class # => Symbol
WhiteHorse [WhiteHorse!~WhiteHors@201.208.150.8] has joined #ruby
<apeiros>
'home#index'.class # => String
<JakeyChan>
:D
<JakeyChan>
understand :)
<JakeyChan>
easy to see
<JakeyChan>
I am a stupid guy
<shevy>
many here are too
<shevy>
rails kinda exposed ruby to many non-ruby guys
<JakeyChan>
yeah yeah yeah :)
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby
<shevy>
I think it is a curse and a blessing
altivec [altivec!~altivec@136.169.141.220] has joined #ruby
<apeiros>
so is it a cursed blessing or a blessed curse?
<shevy>
hmm
<shevy>
more a cursed blessing :D
<shevy>
blessed curse sounds kinda gayish
<shevy>
rails attracted many new people to ruby, I guess many who would have never used ruby. some probably decided to use ruby too, a few perhaps even no longer use rails, but use ruby
<shevy>
but it kinda generated a lot of background noise, rails overshadowing the rest of ruby... then there are so many newbies, which is both good and bad ....
Evixion [Evixion!Evixion@67.235.65.134] has joined #ruby
eldariof [eldariof!~CLD@81.200.24.180] has joined #ruby
cdepue [cdepue!~cdepue@200.117.80.85] has joined #ruby
jetblack [jetblack!~jetblack@99-32-20-118.lightspeed.elgnil.sbcglobal.net] has joined #ruby
Lord-Harlot [Lord-Harlot!Serenity@adsl-77-86-52-54.karoo.KCOM.COM] has joined #ruby
preller [preller!~preller@tapir.feralhosting.com] has joined #ruby
preller [preller!~preller@unaffiliated/preller] has joined #ruby
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby
tomzx [tomzx!~tomzx@dsl-59-207.aei.ca] has joined #ruby
Draco_ [Draco_!~draco@W160.N181.queensu.ca] has joined #ruby
mickn [mickn!~mickn@unaffiliated/mickn] has joined #ruby
raythecat [raythecat!~raythecat@cpe-66-27-147-33.socal.res.rr.com] has joined #ruby
mickn [mickn!~mickn@unaffiliated/mickn] has joined #ruby
maletor [maletor!~maletor@c-69-181-28-195.hsd1.ca.comcast.net] has joined #ruby
NinoScript [NinoScript!~Adium@pc-55-124-83-200.cm.vtr.net] has joined #ruby
bewise [bewise!755d983d@gateway/web/freenode/ip.117.93.152.61] has joined #ruby
mengu [mengu!~mengu@unaffiliated/mengu] has joined #ruby
kennethreitz [kennethreitz!~kennethre@c-24-127-96-129.hsd1.va.comcast.net] has joined #ruby
hinogi [hinogi!~Stefan@mnsr-4db0b33b.pool.mediaWays.net] has joined #ruby
hinogi [hinogi!~Stefan@facade/contributor/hinogi] has joined #ruby
iamjarvo [iamjarvo!~Adium@pool-96-245-10-45.phlapa.fios.verizon.net] has joined #ruby
enikar [enikar!~gil@cl-140.mrs-01.fr.sixxs.net] has joined #ruby
RomD` [RomD`!~Roman@nrbg-d93233a7.pool.mediaWays.net] has joined #ruby
Marco_ [Marco_!~marco@c-98-254-52-240.hsd1.fl.comcast.net] has joined #ruby
jimmy1980 [jimmy1980!~jimmy@112.224.3.72] has joined #ruby
mmokrysz [mmokrysz!~mmokrysz@pdpc/supporter/student/mmokrysz] has joined #ruby
Newbs [Newbs!~textual@host-78-147-56-89.as13285.net] has joined #ruby
Geshpacky [Geshpacky!~textual@p5B390E43.dip0.t-ipconnect.de] has joined #ruby
philcrissman [philcrissman!~philcriss@c-174-53-217-149.hsd1.mn.comcast.net] has joined #ruby
bafilius [bafilius!~lee@ip68-6-93-133.sb.sd.cox.net] has joined #ruby
gayasentinel [gayasentinel!~gayasenti@de.real-vpn.com] has joined #ruby
ph^_ [ph^_!~ph^@cm-84.212.225.74.getinternet.no] has joined #ruby
lonny [lonny!~lonny@122.177.160.114] has joined #ruby
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby
trivol [trivol!~aurelien@ip-178.net-89-2-84.rev.numericable.fr] has joined #ruby
minijupe [minijupe!~benlieb@97-95-236-58.dhcp.sffl.va.charter.com] has joined #ruby
io_syl [io_syl!~io_syl@adsl-69-105-118-125.dsl.pltn13.pacbell.net] has joined #ruby
io_syl [io_syl!~io_syl@unaffiliated/steph021] has joined #ruby
kennethreitz [kennethreitz!~kennethre@c-24-127-96-129.hsd1.va.comcast.net] has joined #ruby
wmoxam_ [wmoxam_!~wmoxam@69-196-129-140.dsl.teksavvy.com] has joined #ruby
bier [bier!~bier@p57999B97.dip.t-dialin.net] has joined #ruby
mmokrysz [mmokrysz!~mmokrysz@pdpc/supporter/student/mmokrysz] has quit [#ruby]
dotnull [dotnull!~DotNull@173-31-158-182.client.mchsi.com] has joined #ruby
QaDeS [QaDeS!~mklaus@frbg-5d84e0e6.pool.mediaWays.net] has joined #ruby
S0lign0c [S0lign0c!~S0lign0c@jeproteste.info] has joined #ruby
<S0lign0c>
hi
holybit [holybit!~alpine_st@c-75-71-177-16.hsd1.co.comcast.net] has joined #ruby
<S0lign0c>
i've a strange think in Ruby with Array. exemple a = [0,0] b = a a[0] = 1 and b change too with [1,0] oO
<S0lign0c>
Ah ok i have to make b = Array.new(a) to copy
<shevy>
*thing, not think
<shevy>
S0lign0c b = a.dup
RusAlex [RusAlex!~alex@184.82.79.106] has joined #ruby
<RusAlex>
hi guys, please help with ruby to a starter
apeiros [apeiros!~apeiros@77-58-115-24.dclient.hispeed.ch] has joined #ruby
<RusAlex>
but when i try to convert it to an Array object a = JSON.parse tr.visitors
<RusAlex>
error occurs
<RusAlex>
"can't convert nil into String"
<RusAlex>
im going to store an Array object in my sqlite row property
jimmy1980 [jimmy1980!~jimmy@112.224.3.72] has joined #ruby
<RusAlex>
but error occurs when im trying to parse my json
_numbers [_numbers!~xxxxxx@unaffiliated/numbers/x-253875] has joined #ruby
_numbers [_numbers!~xxxxxx@unaffiliated/numbers/x-253875] has quit [#ruby]
thone [thone!~thone@g229077100.adsl.alicedsl.de] has joined #ruby
cafesofie [cafesofie!~user@ool-18b97779.dyn.optonline.net] has joined #ruby
<shevy>
no idea about json
<shevy>
but when you have an error message like that, you have a nil object somewhere
<shevy>
"abc"+nil # => TypeError: can't convert nil into String
<QaDeS>
anybody experiences with middleman? i'm running crazy here with setting/retrieving the environment it should run in
<shevy>
perhaps JSON.parse returns garbage
awesome [awesome!~awesome@212.62.202.84.customer.cdi.no] has joined #ruby
<RusAlex>
is datamapper support after get magic for records ?
rushed [rushed!~rushed@cpe-70-116-11-35.austin.res.rr.com] has joined #ruby
vitoravelino [vitoravelino!~rockhampt@187.86.5.112] has joined #ruby
vitoravelino [vitoravelino!~rockhampt@unaffiliated/vtr] has joined #ruby
<shevy>
what
p0y [p0y!~p0y@121.97.59.227] has joined #ruby
<RusAlex>
i want to init or change some datamapper model properties, after getting it via Model.get(id) , for example i want to parse my json encoded fields
<blueadept>
what's the best way of looping through two different variables, one after another in ruby?
<blueadept>
like an infinate loop that goes 0, 1, 0 , 1, 0...
<burgestrand>
[0, 1].cycle
<blueadept>
ah, cool, thanks!
<burgestrand>
It’ll give you an enumerator infinitely going 0, 1, 0, 1…
philcrissman [philcrissman!~philcriss@c-174-53-217-149.hsd1.mn.comcast.net] has joined #ruby
<blueadept>
hm, wait, what if you're a loop inside another loop though
<RusAlex>
shevy: is datamapper can do that ?
<RusAlex>
it's like a get'
<burgestrand>
blueadept: what about it?
<RusAlex>
it's like a 'get' hook
<blueadept>
so cycle will work inside a loop as well?
<RusAlex>
similar to create, update, delete hooks in datamapper
<burgestrand>
blueadept: try it in IRB once
<blueadept>
will do
<burgestrand>
blueadept: just the thing I wrote
<rippa>
I like enumerators
<rippa>
a = [0,1]; a.next; a.next
<rippa>
and stuff
<S0lign0c>
shevy: thank you
jarjar_prime [jarjar_prime!~mjarjoura@50-76-61-133-ip-static.hfc.comcastbusiness.net] has joined #ruby
cdepue [cdepue!~cdepue@200.117.80.85] has joined #ruby
<blueadept>
rippa, that's another cool way as well
<rippa>
or stuff procs into the array and do a.next.call
<rippa>
possibilities are endless
wedgeV [wedgeV!~wedge@cpe-68-173-18-241.nyc.res.rr.com] has joined #ruby
RusAlex [RusAlex!~alex@184.82.79.106] has joined #ruby
<S0lign0c>
a last question for me, is there a better and comprehensive alternative to 0.upto(myArray.size-1) ?
rickmasta [rickmasta!~rickmasta@pool-108-21-213-102.nycmny.fios.verizon.net] has joined #ruby
<rippa>
array[0..-2]
<S0lign0c>
i've find i think is myArray.times
<rippa>
or not
<S0lign0c>
rippa: maybe i go trying
<rippa>
it yields elements of array though
<rippa>
not numbers
<rippa>
you could to with_index but that's just perversion
<S0lign0c>
rippa: ok
<S0lign0c>
array.times is the best i thikn for a loop
earcar [earcar!~earcar@145.116.231.100] has joined #ruby
<rippa>
wouldn't work though
<S0lign0c>
array.size.times sorry
<rippa>
array.size.times would
<S0lign0c>
\o/ same time
<Mon_Ouie>
array.each_index
<samuelkadolph>
(0..array.size).each
mengu_ [mengu_!~mengu@88.233.4.192] has joined #ruby
mengu_ [mengu_!~mengu@unaffiliated/mengu] has joined #ruby
RusAlex [RusAlex!~alex@184.82.79.106] has joined #ruby
Sailias [Sailias!~jonathan@CPE0018f85e576d-CM001bd7aaaf96.cpe.net.cable.rogers.com] has joined #ruby
RusAlex [RusAlex!~alex@184.82.79.106] has quit [#ruby]
Cervajz [Cervajz!~Cervajz@opensuse/member/Cervajz] has joined #ruby
mengu_ [mengu_!~mengu@78.182.80.195] has joined #ruby
mengu_ [mengu_!~mengu@unaffiliated/mengu] has joined #ruby
christian__ [christian__!~christian@190.232.34.241] has joined #ruby
_|christian|_ [_|christian|_!~christian@190.232.34.241] has joined #ruby
me345 [me345!~me345@75.15.183.164] has joined #ruby
kakaskin [kakaskin!~kakaskin@87.252.227.117] has joined #ruby
apeiros [apeiros!~apeiros@77-58-115-24.dclient.hispeed.ch] has joined #ruby
rvmeier [rvmeier!~rodrigo@pc-136-172-241-201.cm.vtr.net] has joined #ruby
mengu_ [mengu_!~mengu@85.97.181.32] has joined #ruby
mengu_ [mengu_!~mengu@unaffiliated/mengu] has joined #ruby
adeponte [adeponte!~adeponte@pool-173-51-131-236.lsanca.fios.verizon.net] has joined #ruby
<kakaskin>
hi
<kakaskin>
i study examples from Rob Fulton`s book
ciunix [ciunix!~ciunix@151.65.183.84] has joined #ruby
<apeiros>
that'd be one reason more to use ri instead of web docs…
<apeiros>
rdoc.info uses yard, which documents private methods too.
<hadronzoo>
apeiros: right, duly noted. Thanks.
<minijupe>
apeiros: the method(:blank?) seems not to give information that would lead me to where it's defined: http://pastie.org/3001494
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby
<ciunix>
I'm a newbie in ruby and sinatra, I'm trying to pass with an html form post a json data.. Could somebody explain me how can I parse that json in sinatra?
<apeiros>
minijupe: it does. "#<Method: FarmStore(Object)#blank?>" <-- tells you that you have a FarmStore instance, which inherits the method from Object
<apeiros>
and afaik, Object#blank? should always return false.
<minijupe>
apeiros: ok, thanks. but why does it return true?
<apeiros>
ciunix: install the json gem, require 'json', then use JSON.parse(string)
<apeiros>
minijupe: no idea.
jtrudeau [jtrudeau!~jeff@c-76-127-237-194.hsd1.ma.comcast.net] has joined #ruby
<ciunix>
apeiros coul I show the code? it's very very simple
<apeiros>
ciunix: I suggest you try it yourself first, and when it doesn't work, I'll take a look…
<ciunix>
I tried it before
<ciunix>
for this reason I asked it
<ciunix>
I'm using sinatra slim and json gem
<apeiros>
ciunix: then paste the relevant code e.g. on pastie.org
<ciunix>
ok
CannedCorn [CannedCorn!~CannedCor@cpe-66-65-102-78.nyc.res.rr.com] has joined #ruby
<ciunix>
thanks apeiros
thepix [thepix!~pix@91.193.160.245] has joined #ruby
<blueadept>
rippa, you here?
<rippa>
yes
<blueadept>
.next doesn't work in rails
<blueadept>
giving me undefined method
ceej [ceej!~anonymous@cpe-72-190-40-203.tx.res.rr.com] has joined #ruby
<blueadept>
but it should work right?
<rippa>
it works on enumrators
<blueadept>
oh
<rippa>
what are you calling it on?
raythecat [raythecat!~raythecat@cpe-66-27-147-33.socal.res.rr.com] has joined #ruby
<rippa>
i.e. a = [0,1].cycle; a.next
mikepack [mikepack!~mikepack@c-174-51-77-22.hsd1.co.comcast.net] has joined #ruby
maletor [maletor!~maletor@c-69-181-32-226.hsd1.ca.comcast.net] has joined #ruby
<apeiros>
zul_: that's not valid json you get there
<zul_>
no???
<zul_>
just a moment
<apeiros>
no. it looks like an inspect of a string that would be valid json.
<apeiros>
how do you send the json?
<apeiros>
or rather, generate it?
cdepue_ [cdepue_!~cdepue@host18.190-139-29.telecom.net.ar] has joined #ruby
<apeiros>
what I find fascinating is that it doesn't error out on the first non-whitespace. that's already illegal. the root of json must always be an array or an object - that is [] or {}.
timonv [timonv!~timonv@140pc227.sshunet.nl] has joined #ruby
<apeiros>
then again, that 743 probably isn't meant to be a position…
<apeiros>
zul_: funny, so it was precisely what I said
<apeiros>
zul_: `puts d`
<zul_>
really?
<apeiros>
paste that into your form
<zul_>
ok
<apeiros>
you took an inspect of a string containing valid json. but an inspect of a string != the string.
ziggles [ziggles!~ziggles@c-24-6-247-92.hsd1.ca.comcast.net] has joined #ruby
<apeiros>
{a: 1} <-- valid json
<apeiros>
"{a: 1}" <-- *not* valid json
friskd [friskd!~friskd@71-95-209-242.static.mtpk.ca.charter.com] has joined #ruby
<apeiros>
if you do: x = "{a: 1}", x contains valid json. x' inspect is "{a: 1}" (including the quotes), which is NOT valid json. you want the output of `puts x`, which is {a: 1}, which is valid json.
<rippa>
x.inspect is "\"{a: 1}\""
<apeiros>
rippa: no, x.inspect.inspect is that.
<apeiros>
which you're looking at if you do x.inspect in your irb.
<rippa>
inspectception
<zul_>
ok
<rippa>
we need to go deeper
<GoldenPie>
apeiros: Sorry, i'm pulling it form a database, and want to format it
<apeiros>
GoldenPie: uh, strftime then
<apeiros>
and/or whatever accessors you need. ri DateTime
Amirh [Amirh!~amir@2.181.24.15] has joined #ruby
cdepue [cdepue!~cdepue@200.117.90.63] has joined #ruby