xcesariox has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
whatasunnyday has joined #ruby
UserOO7 has quit [Ping timeout: 244 seconds]
<baweaver>
CSWookie Look up Pry
<whatasunnyday>
hello pals, long time since i've visted here. having problems googling this. say i'm in a rails app. i want to require my model in my lib. what do i write? my structure is $RAILS_ROOT/lib/foo/bar.rb. i've tried require_relative '../../app/models/model.rb and a few other combos. i'm running it as bundle exec ruby lib/foo/bar.rb
<CSWookie>
baweaver: Does it come with Ruby, or is it some gem I'll have to install? I'm using a ruby that's been embedded in a program, so I don't think I can use any gems that aren't there to begin with.
<baweaver>
whatasunnyday: ?rails
<baweaver>
?rails
<ruby[bot]>
Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
<baweaver>
CSWookie It's a gem
<whatasunnyday>
baweaver, okay, cool. i'll head on over there instead. thought it was more of a #ruby thing since it is a poro :(.
<baweaver>
though it sounds like a bad idea
<CSWookie>
baweaver: Nothing that comes with ruby out of the box?
<baweaver>
don't require anything, use dependency injection
jphase has quit [Remote host closed the connection]
hakunin_ has joined #ruby
hakunin has quit [Read error: Connection reset by peer]
sdwrage has quit [Quit: Leaving]
RedNifre has quit [Ping timeout: 265 seconds]
radic has joined #ruby
Blackpajamas has quit [Quit: Ciao!]
<whatasunnyday>
t3ra, i think books are really helpful. everybody learns different so the best thing you can do is stick with it. if something a particular tutorial or book isn't working for you, try something different. everybody learns differently.
<whatasunnyday>
check your local library for something free. amazon has a lot of options but see if can read a chapter of the book first. a lot of authors have samples on their site or the publishers.
<whatasunnyday>
i'm out tho
<whatasunnyday>
see ya later
<whatasunnyday>
good luck t3ra , thanks again for the help baweaver
RobertBirnie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
RobertBirnie has joined #ruby
UserOO7 has joined #ruby
snguyen has joined #ruby
Canucktux has joined #ruby
<t3ra>
thank you whatasunnday - sorry didnt see your message before you left
jphase has joined #ruby
<getxsick>
hi, can someone explain me (or point to an article) what changes happened to the Test::Unit? I am new to Ruby, so I guess it's quite obvious for everyone but me. After some investigation I know that Test::Unit was in stdlib until Ruby1.8 then it's become a gem. But the old version (1.2.3) is still available in stdlib in newer versions of Ruby. I believe it's called MiniTest now but still availble via requir
<getxsick>
e 'test/unit', right? So, when I want to use the newest version of the Test::Unit i have to install the gem and then activate the gem via `gem 'test-unit'` before importing it.
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<getxsick>
i mean, i want to check what version of Minitest is used
<baweaver>
yep, gemfile
_sfiguser has quit [Ping timeout: 244 seconds]
<baweaver>
then when you to a `bundle install` it'll generate a Gemfile.lock which will say what versions of everything got installed
<baweaver>
read through that link above
UserOO7 has joined #ruby
JeanCarloMachado has quit [Ping timeout: 272 seconds]
t3ra has quit [Ping timeout: 240 seconds]
fullofcaffeine has quit [Remote host closed the connection]
<baweaver>
anyways, I'm calling it a night, cheers
fullofcaffeine has joined #ruby
cyphase has quit [Ping timeout: 272 seconds]
t3ra has joined #ruby
FINbit has quit [Ping timeout: 244 seconds]
sp4rrow has quit [Quit: Textual]
Mrgoose has joined #ruby
<Mrgoose>
Hi im new to ruby and im trying to run a rspect test and i get this error . `<module:Crypto>': uninitialized constant Common::Crypto::Util (NameError)
<Mrgoose>
. Any pointers?
fullofcaffeine has quit [Ping timeout: 244 seconds]
cyphase has joined #ruby
_sfiguser has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
snguyen has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AnFin has left #ruby [#ruby]
crdpink has joined #ruby
eljimmy has joined #ruby
getxsick has quit [Quit: leaving]
cyphase has quit [Ping timeout: 250 seconds]
jackjackdripper has quit [Quit: Leaving.]
eljimbo has joined #ruby
eljimmy has quit [Ping timeout: 248 seconds]
RegulationD has quit [Remote host closed the connection]
cyphase has joined #ruby
fclausen has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
ropeney has joined #ruby
ta_ has joined #ruby
elifoster has quit [Read error: Connection reset by peer]
Guest70147 is now known as bougyman
xemehc has quit [Quit: ZZZzzz…]
cyphase has quit [Ping timeout: 250 seconds]
Rodya_ has quit [Remote host closed the connection]
Rodya_ has joined #ruby
Channel6 has joined #ruby
blackmesa has joined #ruby
ta_ has quit [Ping timeout: 248 seconds]
Rodya_ has quit [Ping timeout: 250 seconds]
jshjsh has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
harfangk has joined #ruby
JoshS has quit [Ping timeout: 244 seconds]
<croberts>
what would this mean in ruby with the ?
<croberts>
fail _("Action not allowed for the default capsule.") if capsule_content.default_capsule?
jshjsh is now known as JoshS
skweek has quit [Ping timeout: 272 seconds]
t3ra has quit [Ping timeout: 264 seconds]
optiz0r has quit [Ping timeout: 240 seconds]
optiz0r has joined #ruby
LuckyABA has joined #ruby
csk has quit [Quit: ZZZzzz…]
Ebok has quit [Quit: Leaving]
LuckyABA has quit [Client Quit]
cyphase_eviltwin has joined #ruby
skweek has joined #ruby
hakunin_ is now known as hakunin
Contigi has quit [Read error: Connection reset by peer]
A_Drone has joined #ruby
prawnzy has joined #ruby
A_Drone has quit [Remote host closed the connection]
SuperLag has quit [Ping timeout: 265 seconds]
A_Drone has joined #ruby
s2013 has joined #ruby
prawnzy has quit [Ping timeout: 250 seconds]
cyphase_eviltwin has quit [Ping timeout: 265 seconds]
crdpink has quit [Quit: q term]
ramfjord has quit [Ping timeout: 240 seconds]
NetSage has joined #ruby
crdpink has joined #ruby
wethu has quit [Read error: Connection reset by peer]
wethu has joined #ruby
cyphase_eviltwin has joined #ruby
LuckyABA has joined #ruby
chouhoulis has quit [Ping timeout: 265 seconds]
prawnzy has joined #ruby
cyphase_eviltwin has quit [Ping timeout: 265 seconds]
nankyokusei has joined #ruby
jblack has joined #ruby
nankyokusei has quit [Ping timeout: 240 seconds]
braincras has quit [Ping timeout: 272 seconds]
cyphase_eviltwin has joined #ruby
tjbiddle has joined #ruby
cyphase_eviltwin has quit [Max SendQ exceeded]
jblack has quit [Ping timeout: 248 seconds]
cyphase_eviltwin has joined #ruby
RegulationD has joined #ruby
A_Drone has quit [Remote host closed the connection]
braincrash has joined #ruby
solocshaw has quit [Ping timeout: 255 seconds]
RegulationD has quit [Ping timeout: 244 seconds]
A_Drone has joined #ruby
A_Drone has quit [Remote host closed the connection]
A_Drone has joined #ruby
cyphase_eviltwin has quit [Ping timeout: 244 seconds]
FINbit has joined #ruby
blackmesa has joined #ruby
ta_ has joined #ruby
sai_ has joined #ruby
crdpink has quit [Quit: q term]
FINbit has quit [Ping timeout: 240 seconds]
craigp_ has quit [Ping timeout: 244 seconds]
cyphase has joined #ruby
blackmesa has quit [Ping timeout: 250 seconds]
dviola has quit [Quit: WeeChat 1.5]
sai_ has quit [Remote host closed the connection]
braincrash has quit [Ping timeout: 265 seconds]
ur5us has quit [Remote host closed the connection]
ur5us has joined #ruby
crdpink has joined #ruby
hutch34_ has joined #ruby
braincrash has joined #ruby
ur5us has quit [Read error: No route to host]
NetSage has quit [Remote host closed the connection]
nando293921 has quit [Read error: Connection reset by peer]
A_Drone has quit [Ping timeout: 265 seconds]
braincrash has joined #ruby
braincrash is now known as braincras
prawnzy has quit [Remote host closed the connection]
AndrewIsHere has quit [Remote host closed the connection]
cyphase has joined #ruby
arescorpio has joined #ruby
A_Drone has joined #ruby
tmtwd has quit [Ping timeout: 260 seconds]
jshjsh has joined #ruby
JoshS has quit [Ping timeout: 244 seconds]
sneakerhax has joined #ruby
sneakerhax has quit [Client Quit]
jenrzzz has joined #ruby
sneakerhax has joined #ruby
jshjsh is now known as JoshS
tmtwd has joined #ruby
cyphase has quit [Ping timeout: 265 seconds]
duderonomy has joined #ruby
Beast has joined #ruby
<baweaver>
croberts: did you get an answer?
A_Drone has quit [Remote host closed the connection]
AnarchyAo has quit [Ping timeout: 240 seconds]
Devalo has joined #ruby
<baweaver>
In Ruby a method can end in ? or !. Common standard is that ? signifies a boolean method on an object, and ! signifies some form of mutation or dangerous operation.
<baweaver>
>> 1.even? # Think of ? ask asking a question of an object
<baweaver>
Now they don't _have_ to return a boolean, but you'll probably confuse / anger people by doing so.
A_Drone has joined #ruby
_djbkd has joined #ruby
linux1413 has joined #ruby
A_Drone has quit [Remote host closed the connection]
Devalo has quit [Ping timeout: 240 seconds]
tmtwd has quit [Ping timeout: 244 seconds]
codelogix has joined #ruby
jackjackdripper has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
gix has quit [Ping timeout: 265 seconds]
<codelogix>
can anyone tell me how to override created_at timestamp in Rails, on create?
<codelogix>
trying to increment the created_at timestamp by one day, if it's a leap year.
A_Drone has joined #ruby
A_Drone has quit [Client Quit]
<linux1413>
codelogix: And you need to specifically change some certain instances?
gix has joined #ruby
<linux1413>
Because you can specify the `created_at` date in rails on create, but the datetime libraries know how to perform the right adjustments for leap year.
<codelogix>
I have a model that is for subscriptions, and I'm using the created_at timestamp to know when to charge them for the next recurring payment...and if it's a leap year, I want to increment the created_at timestmap by one day, so if it is a leap year, and the month is feburary, then I want to increment it by one day.
<codelogix>
is it possible to override it in the model? Or do I just have to set it in the call to create?
blackmesa has joined #ruby
hutch34_ has joined #ruby
<linux1413>
You can make a callback or something. But I still think there might be an answer.
zel has joined #ruby
<linux1413>
Does your model contain the future date in which the subscription renews?
ResidentBiscuit has quit [Ping timeout: 255 seconds]
zel is now known as Guest37090
<codelogix>
it contains the length in years or months, and the period which is (monthly, or annual)
nullniverse has joined #ruby
hutch34_ has quit [Client Quit]
<codelogix>
and is charged based on the created_at(when the subscription started, and the period (monthly, or annual) and the length is used to set the end_date
AndrewIsHere has joined #ruby
AndrewIsHere has quit [Client Quit]
<linux1413>
Date.new(2016, 2, 29) + 1.year
cyphase has quit [Ping timeout: 248 seconds]
gnufied has quit [Ping timeout: 255 seconds]
<linux1413>
Gives 28th of February 2017.
<codelogix>
huh...so ruby already takes that into account and accounts for it
gnufied has joined #ruby
<dmtd>
strongcode and baweaver: thank you! I had stepped away for a bit but that was great advice and helped a lot. Thank you!
blackmesa has quit [Ping timeout: 265 seconds]
eljimmy has joined #ruby
be_______ has joined #ruby
jblack has joined #ruby
<linux1413>
Also, if you're into these kinds of things, MySQL (making assumptions here) should have great support for dates, too.
<strongcode>
np, glad it helped
<baweaver>
Also be sure to look into #RubyOnRails for Rails questions
petercooper has joined #ruby
<codelogix>
I tried #RubyOnRails...and nobody responded...so I figured I would try here.
alfiemax has quit [Ping timeout: 250 seconds]
<codelogix>
thanks for the help
<codelogix>
thanks linux1413!
ben______ has quit [Ping timeout: 250 seconds]
eljimbo has quit [Ping timeout: 250 seconds]
cyphase has joined #ruby
ICantCook has joined #ruby
<codelogix>
\q
elenatanasoiu has joined #ruby
jblack has quit [Ping timeout: 260 seconds]
skweek has quit [Ping timeout: 272 seconds]
bqscott has quit [Quit: Connection reset by peer]
matp has quit [Ping timeout: 265 seconds]
elenatanasoiu has quit [Ping timeout: 276 seconds]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mkl has quit [Read error: Connection reset by peer]
tomphp has joined #ruby
pawnbox has quit [Remote host closed the connection]
Ishido has joined #ruby
ta_ has joined #ruby
fclausen has quit [Quit: Lost terminal]
bsrd has joined #ruby
ratatine has quit [Ping timeout: 265 seconds]
pawnbox has joined #ruby
CuriousMind has quit [Ping timeout: 240 seconds]
mikecmpbll has joined #ruby
Guest98158 has quit [Excess Flood]
sonikspin has joined #ruby
flying has joined #ruby
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mtkd has quit [Read error: Connection reset by peer]
^mtkd has joined #ruby
TriremeMonotreme is now known as Madplatypus
elenatanasoiu has joined #ruby
blackmesa has quit [Ping timeout: 264 seconds]
greg96722 has joined #ruby
hahuang61 has joined #ruby
Macaveli has joined #ruby
hahuang61 has quit [Ping timeout: 264 seconds]
codelogix has joined #ruby
<TomyWork>
My $: contains "/usr/lib64/ruby/1.8", among others, but "require 'rubygems'; gem 'puppet'" doesn't find the gem under "/usr/lib64/ruby/gems/1.8/gems/puppet-3.8.7"
pawnbox has quit [Remote host closed the connection]
<TomyWork>
yet it finds the other gems in that directory
nadir has quit [Quit: Connection closed for inactivity]
nankyokusei has joined #ruby
claudiuinberlin has quit []
aguynamedben has joined #ruby
nalik has joined #ruby
tpendragon has joined #ruby
<TomyWork>
btw, sles is great. ruby1.8-rubygem-puppet-3.8.7-8.1 installs the puppet gem into the wrong directory and they updated ruby1.8-rubygem-json_pure from 1.8.3-37.4 to 2.0.2-42.1
<TomyWork>
with predictable results
nankyokusei has quit [Ping timeout: 240 seconds]
mark_66 has quit [Remote host closed the connection]
pawnbox has joined #ruby
blackmesa has joined #ruby
<Zarthus>
ruby 1.8? That's not EOL yet?
mark_66 has joined #ruby
<apeiros>
that's EOL for ages
<apeiros>
1.9 is also EOL
<apeiros>
not sure whether 2.0 is also already EOL
yumez has quit []
blackjid has joined #ruby
<apeiros>
yupp, 2.0 is also EOL
leea has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
last_staff has joined #ruby
<apeiros>
2.1 is in "security patches only" phase
RegulationD has joined #ruby
Guest54448 has joined #ruby
Dimik has quit [Ping timeout: 264 seconds]
<TomyWork>
like i said, sles is great
<Zarthus>
I'd have to understand what it is before I can comment on that :P
<Zarthus>
A Google mentions things about Lupus, that doesn't sound very ruby-like.
solocshaw has joined #ruby
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
ichkv has quit [Remote host closed the connection]
<TomyWork>
suse linux enterprise server. 11, to be precise
RegulationD has quit [Ping timeout: 255 seconds]
<Zarthus>
that sounds like something that maintains old versions of software with security patches
<TomyWork>
precisely
<Zarthus>
My idea of "great" doesn't align with yours. Ruby 2.3 is where it's at :P
* TomyWork
hands Zarthus a sarcasm detector
<Zarthus>
Sarcasm doesn't work well over a text-transmit protocol :P
senayar has joined #ruby
<TomyWork>
well if you had ever used sles11, it would be obvious, regardless of the medium
<TomyWork>
yes, including smoke signals and silbo
<Zarthus>
my oldest maintained (software/)server is on debian 8.5 or ubuntu 1404
workerbeetwo has quit [Remote host closed the connection]
<Zarthus>
i'm rather satisfied with tha
jsrn_ has joined #ruby
salut has joined #ruby
hirvi has joined #ruby
DaniG2k has joined #ruby
solocshaw has quit [Remote host closed the connection]
<TomyWork>
fine systems
<TomyWork>
i'm on the later right now and i'm going to start setting up one of the former in a minute
<xpt>
TomyWork: sorry, to hear that you have to use SLES :( The best idea to have something good on it is to get it from outside official repo (I compiles couple of things_
TomyWork has left #ruby ["Leaving"]
TomyWork has joined #ruby
face has quit [Ping timeout: 240 seconds]
<TomyWork>
whoops wrong button
tomphp has joined #ruby
<TomyWork>
xpt well puppet 3 works on ruby 1.8 and i have no security requirements for that box, so i'm fine
<apeiros>
BUTTONS UNTO THE BUTTON GODS!
<aurelien>
is the ruby version of redhat (2.0.0p598) enough for developpement at the time it can use rubygems.org?
<apeiros>
2.0 is EOL
<apeiros>
it's enough to develop
<apeiros>
but if you can, use 2.3
<TomyWork>
i was able to downgrade that json_pure package so puppet works again, yay
blackmesa has quit [Ping timeout: 244 seconds]
<aurelien>
apeiros: how can i do to use 2.3 on rhel7 without breaking everythings?
<TomyWork>
do you have to?
<aurelien>
idk ... a dev request for it saying he cannot dev with 2.0
<apeiros>
aurelien: I don't use rhel, so I wouldn't know. I guess you should ask that in the redhat channel?
<TomyWork>
aurelien rhel7 is already more than 2 years old
<apeiros>
common ways to install ruby outside of package managers: chruby+ruby-install, rvm
<aurelien>
TomyWork: I know ... but I do with what I have, not what I wish
<TomyWork>
if you can, use a more recent distro
<aurelien>
TomyWork: I would use Archlinux if I was the one who decide ;-)
solocshaw has joined #ruby
<TomyWork>
ubuntu 16.04 is also a stable distro and it's much more recent
<aurelien>
TomyWork: Archlinux is the most recent one ... and rolling release
<TomyWork>
yes, that is not a good thing
<aurelien>
TomyWork: and best should to use Parabola ... to keep all things faif
<TomyWork>
it guarantees that no two of your boxes will be the same
spectrum has quit [Ping timeout: 265 seconds]
<aurelien>
hmm ... if you maintain them correctly ... a simple pacman -Syu garantee that
solocshaw has quit [Remote host closed the connection]
<aurelien>
and the faif solution garantee that its free today and tomorrow which is not the point with ubuntu
dionysus69 has joined #ruby
<aurelien>
well ... the point was just about the ruby version
<TomyWork>
you keep saying "faif", is your keyboard broken or does that mean something?
<aurelien>
thanks for your lights
<aurelien>
Free As In Freedom
<aurelien>
just like ruby is
<TomyWork>
i dont think that should be your primary concern in production :)
<aurelien>
But it should be
<TomyWork>
but what if an update breaks your production?
<aurelien>
and it will be the day that lawyer of business will understand computer science :-)
solocshaw has joined #ruby
<TomyWork>
rolling releases basically guarantees that you will have updates that break your production
<aurelien>
hmm archlinux parabola and much more use it as production server without break
hirvi has quit [Quit: leaving]
<TomyWork>
you mean the people who make the distro use the distro without it breaking?
Immune has quit [Ping timeout: 260 seconds]
<aurelien>
and at least you can break a production server with a very stable rhel or debian, depending of the stuff you update ...
<TomyWork>
you mean the people who make the distro use the distro without it breaking? do you consider that an argument in favor of using rolling releases in prod?
<TomyWork>
and of course, if you switch releases, you can have breakage. but you dont switch releases without thorough testing.
<aurelien>
I use rolling release and version distro for production and meet the same trouble all the time: There is no warranty that a dep will not break the stuff
<aurelien>
and that just with an update.
erlingur has joined #ruby
<TomyWork>
with rolling releases, breakage is part of the design
claudiuinberlin has joined #ruby
<aurelien>
and coming back from the death is also a part of the design
<canton7>
TomyWork, what makes you say that? I'ver never had a breakage, by design or otherwise, on a rolling release
<aurelien>
TomyWork: we should discuss about that arround a beer
<canton7>
... not that I'd use a rolling release in production, but that's a different question
hirvi has joined #ruby
Immune has joined #ruby
<TomyWork>
canton7 take a simple example: openssl recently kicked out a ton of old ciphers (breaking some clients) and messed with the API (breaking some software, even with the possibility of introducing security bugs).
<TomyWork>
once that change hits arch, if it didnt already, you will notice it :)
<canton7>
... and the updates were only allowed into the arch repos once they'd be thoroughly tested against all of the other stuff has been verified not to break
sai_ has joined #ruby
<canton7>
*and had been verified not to break
<TomyWork>
but they arent verified against your non-arch stuff
pwnd_nsfw has joined #ruby
sai_ has quit [Remote host closed the connection]
<canton7>
right, so you're not talking about the distro itself breaking, you're talking about rare, major backwards-incompatible changes in packages not being supported outside of the distro
<TomyWork>
not quite
<canton7>
so the difference is that a rolling release will expose the issue sooner: a dist upgrade of any other distro will have the same issue, sooner or later
<TomyWork>
openssl is part of the distro
<TomyWork>
they introduce a breaking change
<TomyWork>
every other package in the distro updates accordingly
<TomyWork>
but your custom stuff isnt updated
<canton7>
I don't see how that's any more "broken by design" than a dist upgrade of any other distro :P
<alfiemax>
what is this : Metrics/AbcSize ?? ref rubocop
symm- has joined #ruby
Circuit8 has joined #ruby
craigp_ has quit [Ping timeout: 265 seconds]
workmad3 has joined #ruby
* apeiros
keeps forgetting that chrisseaton works on jruby :)
<Circuit8>
Hi guys, got a question about file operations. When I do this: `f = File.new("test.txt", "w")` it works. But when i do this: `fd = IO.sysopen("badger.txt") ; stream = IO.new(fd,"w")` I get the following error: `Errno::EINVAL: Invalid argument` . It works if I open the file for reading rather than writing. Can anyone help me with this?
<devil_tux>
Circuit8: ask shortCircuit__ :p
<devil_tux>
kidding
<devil_tux>
give us the code
<shortCircuit__>
:D
JeanCarl1Machado has joined #ruby
<Circuit8>
devil_tux: That is the code
<shortCircuit__>
thats more than 3 lines
<shortCircuit__>
gist it
<devil_tux>
whoops, there you go :-)
<apeiros>
Circuit8: why do you even do it this way?
<devil_tux>
shortCircuit__: 80 lines limit :P
<Circuit8>
ok ok, one sec
<apeiros>
Circuit8: and I'd say you should not use the 2nd arg in IO.new(fd)
<apeiros>
as the file is already open
<shortCircuit__>
oh .. try File.open(filename) that will yield an io object that empowers with io stream
<Circuit8>
apeiros: Actually, the example is working, but not when i use a normal file
<Circuit8>
so when I open `/dev/tty` for writing its OK
<shortCircuit__>
I wonder why no one makes a good version of ruby docs
<Circuit8>
but when i open `text.txt` its not
blackmesa has joined #ruby
<shortCircuit__>
./text.txt
<shortCircuit__>
the path is correct!!
<Circuit8>
shortCircuit__: I can open it for reading
<apeiros>
Circuit8: I guess the mode is discarded for that case
<apeiros>
because it makes no sense to open it twice
GreatSUN has joined #ruby
<GreatSUN>
hi all
<Circuit8>
apeiros: I'm not opening it twice though
<GreatSUN>
I am using ruby 2.2.4
<apeiros>
both, /dev/tty and a real file will work with just IO.new(fd)
<apeiros>
Circuit8: yes, you do. 1. sysopen, 2. IO.new
craigp_ has joined #ruby
<GreatSUN>
suddenly when trying to run gem install openssl I get the error that no valid gem could be found in any repo
<Circuit8>
apeiros: Ah ok, i dont quite understand the difference between the two
<GreatSUN>
can someone help me with this, please?
<GreatSUN>
using redhat 7.2
<Circuit8>
apeiros: Why do we use sysopen + IO.new?
<apeiros>
Circuit8: one returns the underlying file descriptor (an integer), one returns an actual IO instance
<apeiros>
I don't know when you'd actually use sysopen.
<apeiros>
I guess when you have no need for the IO object and only need the fd.
<Circuit8>
apeiros: Ah OK, so sysopen opens the file but doesnt give you a ruby object to actually do anything to the file with. New opens the file and gives you an IO object which you can do stuff with?
<apeiros>
yes
<apeiros>
and IO.new(fd) will wrap the opened fd in a ruby IO object
<Circuit8>
apeiros: Ah I see
<apeiros>
at least that's my understanding. it's not like I'd use that daily :D
<Circuit8>
apeiros: Thanks :)
<apeiros>
and you can get the fd from an IO object just fine. so I'm really not sure when it'd make sense to use sysopen.
<Circuit8>
apeiros: I dont think you can use IO.new without a fd though, it requires one to instantiate
stamina has joined #ruby
<apeiros>
Circuit8: right, you'd use IO.open
blackmesa has quit [Ping timeout: 248 seconds]
<apeiros>
errr, wait…
* apeiros
so used to use File.open, already forgotten IO's API :-S
<Circuit8>
apeiros: So does IO.open basically call IO.new( IO.sysopen("filename", "mode"))?
LambdaSix has quit [Ping timeout: 244 seconds]
<apeiros>
na, IO.open is basically: def self.open(*args); io = new(*args); yield(io) if block_given?; io; end
[k- has joined #ruby
<apeiros>
i.e. it'll yield a block with the IO instance if a block is passed, other than that, it's equivalent to IO.new
LambdaSix has joined #ruby
<apeiros>
I was mistaken when I said you'd use IO.open. I thought File.open was unchanged IO.open and thus would work the same. but that's wrong.
tvw has quit []
<apeiros>
hu? wth
<apeiros>
ah
<Circuit8>
apeiros: Ah OK, it all makes a lot more sense now
<apeiros>
meh - I should pay more attention when I do some quick tests :D never mind my "hu? wth"
<Circuit8>
apeiros: One things I dont quite get with this example in the docs though, why does the `a = IO.new(fd,"w")` need the "w"? It works fine without it as its already opened for writing from the sysopen: http://ruby-doc.org/core-2.0.0/IO.html#method-c-new-label-Example+1
<apeiros>
but that's interesting. File.open is indeed IO.open unchanged. File.new is what makes it different :)
<apeiros>
Circuit8: no idea. I think it shouldn't be there. but I might lack some low-level knowledge there.
<Circuit8>
apeiros: OK thanks a lot for your help I really appreciate it :)
claudiuinberlin has joined #ruby
sai_ has quit [Remote host closed the connection]
Circuit8 has quit [Quit: Page closed]
dtusk has quit [Ping timeout: 244 seconds]
JeanCarl1Machado has quit [Ping timeout: 265 seconds]
Macaveli has joined #ruby
JeanCarloMachado has joined #ruby
hahuang61 has joined #ruby
dn5 has quit [Ping timeout: 248 seconds]
hahuang61 has quit [Ping timeout: 244 seconds]
dn5 has joined #ruby
JeanCarl1Machado has joined #ruby
Rickmasta has joined #ruby
Rickmasta has quit [Client Quit]
codelogix has joined #ruby
marr has joined #ruby
<GreatSUN>
noone an idea?
postmodern has left #ruby ["Leaving"]
JeanCarloMachado has quit [Ping timeout: 260 seconds]
codelogix has quit [Ping timeout: 240 seconds]
radic has joined #ruby
sai_ has joined #ruby
Immune has quit [Ping timeout: 260 seconds]
astrobunny has quit [Remote host closed the connection]
gizless has quit [Ping timeout: 244 seconds]
dtusk has joined #ruby
gizless has joined #ruby
nankyokusei has joined #ruby
Alina-malina has quit [Ping timeout: 255 seconds]
singalaut has quit [Ping timeout: 260 seconds]
aguynamedben has quit [Ping timeout: 255 seconds]
tpendragon has quit [Ping timeout: 255 seconds]
nankyokusei has quit [Ping timeout: 260 seconds]
blackjid has quit [Ping timeout: 248 seconds]
Immune has joined #ruby
Mon_Ouie has joined #ruby
pwnd_nsfw` has joined #ruby
minimalism has quit [Quit: minimalism]
dn5 has quit [Ping timeout: 265 seconds]
pwnd_nsfw has quit [Ping timeout: 248 seconds]
dn5 has joined #ruby
dtusk has quit [Ping timeout: 265 seconds]
vuoto has quit [Remote host closed the connection]
blackmesa has joined #ruby
gnufied has joined #ruby
sai_ has quit [Read error: Connection reset by peer]
sai__ has joined #ruby
blackmesa has quit [Ping timeout: 255 seconds]
craigp_ has quit [Ping timeout: 272 seconds]
jphase has joined #ruby
Devalo has joined #ruby
RedNifre_ is now known as RedNifre
sai__ has quit [Read error: Connection reset by peer]
sai_ has joined #ruby
jphase has quit [Ping timeout: 250 seconds]
koooge has quit [Quit: Leaving...]
Devalo has quit [Ping timeout: 250 seconds]
hanmac has quit [Ping timeout: 255 seconds]
coolboy has quit [Ping timeout: 248 seconds]
pwnd_nsfw has joined #ruby
pwnd_nsfw` has quit [Ping timeout: 272 seconds]
sai_ has quit [Read error: Connection reset by peer]
<_sfiguser>
hello everyone i'm reading the book "Beginning Ruby" i'm at almost half and at this point, i don't understand very well the concept of module in order to avoid name conflict... i mean, couldn't i at thi point have two modules with the same name and some method with the same name ?
<_sfiguser>
i mean before the problem was related to methods and the risk was that of importing two modules and these modules could have different methods with the same name
<_sfiguser>
but now i can have name conflict since i can have two modules with the same name sharing some methods name
<_sfiguser>
how can i solve ?
<elomatreb>
_sfiguser: The risk of a module name colliding is much lower than that of method names
<darix>
or class names
<darix>
also it gives a nice way to group classes/methods by topic
<_sfiguser>
ahh ok ok elomatreb what if it happens to have two modules with the same name ? i mean i have one module called Graphic and another one with the same name how can i use both ?
<darix>
_sfiguser: when you "create" the 2nd one
<darix>
it will extend the first one
<elomatreb>
You probably want to use nested modules (modules in modules)
blackmesa has joined #ruby
<darix>
because ruby will reopen it and add the the new methods to the first module
<darix>
and overwrite existing methods with the same name
<_sfiguser>
elomatreb, i'm talking about.. for example i download a module from internet and it is called "Graphics" and then from another site i download another module and accidentally it has the same name
<darix>
_sfiguser: as most ruby libraries use rubygems now
<elomatreb>
_sfiguser: That can of course still happen, but it is probably very uncommon, as Ruby modules and libraries are ususally distributed on rubygems.org, which enforces unique names
nikivi has joined #ruby
nikivi has quit [Max SendQ exceeded]
jblack has joined #ruby
Madplatypus has quit [Quit: Connection closed for inactivity]
sai_ has quit [Read error: Connection reset by peer]
cdg has joined #ruby
Rodya_ has joined #ruby
rndUser__ has joined #ruby
swills has quit [Quit: Leaving]
gregf_ has quit [Ping timeout: 240 seconds]
xemehc has joined #ruby
Rodya_ has quit [Ping timeout: 272 seconds]
ramortegui has joined #ruby
elenatanasoiu has joined #ruby
Immune has quit [Ping timeout: 260 seconds]
cyphase has quit [Ping timeout: 255 seconds]
UserOO7 has joined #ruby
swills has joined #ruby
swills has quit [Remote host closed the connection]
codelogix has quit [Ping timeout: 240 seconds]
<_sfiguser>
for my class it is sufficient to reimplement the each method, and then all other methods of Enumerable come for free ?
<_sfiguser>
why ?
Mon_Ouie has quit [Read error: No route to host]
millerti has joined #ruby
<elomatreb>
_sfiguser: Because all other operations in Enumerable can be built using each
hahuang65 has joined #ruby
<_sfiguser>
ok vyt even if i don't include the enumerable module ?
UserOO7_ has joined #ruby
Mon_Ouie has joined #ruby
<elomatreb>
You can replicate the methods in Enumerable, yes. No reason to do it though
cyphase has joined #ruby
<apeiros>
_sfiguser: no. if you don't include the enumerable module, you don't get them.
nikivi has joined #ruby
<_sfiguser>
ok thanks
sai_ has joined #ruby
fmcgeough has joined #ruby
<apeiros>
but if you write the #each properly, namely if you let it return an Enumerator without a block, then you can chain Enumerable methods on .each
swills has joined #ruby
Immune has joined #ruby
shortCircuit__ has joined #ruby
UserOO7 has quit [Ping timeout: 276 seconds]
prawnzy has joined #ruby
claudiuinberlin has joined #ruby
rippa has joined #ruby
Rodya_ has joined #ruby
millerti has quit [Ping timeout: 276 seconds]
hahuang65 has quit [Ping timeout: 244 seconds]
sergio_101 has quit [Remote host closed the connection]
<_sfiguser>
apeiros, why you say "#each" and not "each" ?
<apeiros>
# denotes instance methods
<_sfiguser>
ahh okok
<_sfiguser>
didn't know
blackwind_123 has quit [Ping timeout: 240 seconds]
prawnzy has quit [Ping timeout: 260 seconds]
blackwind_123 has joined #ruby
cyphase has quit [Ping timeout: 265 seconds]
eizua has joined #ruby
codelogix has joined #ruby
aegis3121 has joined #ruby
contradictioned_ has quit [Remote host closed the connection]
Silthias has quit [Ping timeout: 265 seconds]
Macaveli has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<beauby>
Sorry, client crashed. So I was asking: h = Hash.new({}); a = h[:a]; a[:b] = :b; !h.keys.include?(:a) && h[:a].keys.include?(:b) # -> true using ruby 2.3.0. How come?
<beauby>
I mean, I kinda see what's happening under the hood, but I was wondering whether it was expected.
<a1fa>
hello. is there a better way to write Digest::SHA2.hexdigest(rand(DateTime.now.to_i).to_s) - this is not used for any authentication or security for that matter.. its just a random string filler for a temprorary record
<a1fa>
thanks lianj - i am going to benchmark it to see how fas or how much faster is it from what i am doing today
<apeiros>
beauby: got an answer yet?
<a1fa>
this is just a temp string for a compounding key when processing .csv file
<beauby>
apeiros: Well, what is happening is that this statement is in fact modifying the default object, but one (aka me) would expect the default object to be instantiated/duped upon first access
shortCircuit__ has quit [Remote host closed the connection]
<apeiros>
because some people (aka me) wouldn't want that.
<beauby>
apeiros: Would you care to explain why? (Genuinely interested)
<apeiros>
beauby: if you want that, use the block form
<apeiros>
beauby: because accessing the default object should not modify the hash
<beauby>
apeiros: thanks, I hadn't thought of that.
GodFather has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
<apeiros>
otherwise any access would cause new keys to appear in the hash
sai_ has quit [Read error: Connection reset by peer]
djbkd has quit [Quit: Leaving...]
<beauby>
apeiros: makes sense. There could be some kind of "dup upon access, add key upon modification of duped object" but I guess the semantics would be even more confusing
michael_mbp has joined #ruby
hobodave has joined #ruby
nando293921 has joined #ruby
sai_ has joined #ruby
sai_ has quit [Read error: Connection reset by peer]
sai_ has joined #ruby
<apeiros>
indeed, it would be.
nankyokusei has joined #ruby
djbkd has joined #ruby
<apeiros>
and you can always add that.
<apeiros>
Hash#fetch is somewhat close to that.
Immune has quit [Ping timeout: 260 seconds]
sczizzo has joined #ruby
<beauby>
apeiros: yeah, but fetch does not create the key
<beauby>
it's basically a specialized default value
<apeiros>
it too takes a block
<apeiros>
where you can put the code to set the value
Johne has joined #ruby
sandelius has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Johne>
is there an irb plugin for cinch? like you guys have in here to test
eclaire has joined #ruby
nankyokusei has quit [Ping timeout: 265 seconds]
<apeiros>
Johne: search for cinch-* named gems and look out for irb/pry/repl
<apeiros>
oh, and eval
gfvcastro has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
pwnd_nsfw` has joined #ruby
<Johne>
awesome :)
beatdown has joined #ruby
JakFrist has joined #ruby
ichkv has joined #ruby
<apeiros>
not saying there is one. that's just how I'd search for it.
Immune has joined #ruby
xemehc has quit [Quit: ZZZzzz…]
pwnd_nsfw has quit [Ping timeout: 248 seconds]
ResidentBiscuit has joined #ruby
AlexJakeGreen has joined #ruby
codelogix has joined #ruby
ixti has quit [Ping timeout: 265 seconds]
gfvcastro has joined #ruby
aegis3121 has quit [Ping timeout: 276 seconds]
xaxisx has quit [Read error: Connection reset by peer]
daffy_duck_2 has quit [Ping timeout: 240 seconds]
beauby has quit [Ping timeout: 264 seconds]
daffy_duck_2 has joined #ruby
xemehc has joined #ruby
Johne has left #ruby [#ruby]
Technodrome has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
sai__ has joined #ruby
sai_ has quit [Read error: Connection reset by peer]
mesamoo has quit [Ping timeout: 244 seconds]
beatdown has quit [Changing host]
beatdown has joined #ruby
jshjsh has joined #ruby
programmerq has joined #ruby
moos3 has joined #ruby
coolboy has quit [Remote host closed the connection]
gfvcastro has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
JoshS has quit [Ping timeout: 264 seconds]
beauby has joined #ruby
coolboy has joined #ruby
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby
ctp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
ctp has joined #ruby
workmad3_ has joined #ruby
workmad3 has quit [Ping timeout: 265 seconds]
sczizzo_ has joined #ruby
beauby has quit [Ping timeout: 248 seconds]
aegis3121 has joined #ruby
sczizzo_ has quit [Client Quit]
rodfersou is now known as rodfersou|lunch
skweek has joined #ruby
sczizzo has quit [Ping timeout: 276 seconds]
ctp has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
hobodave has quit [Quit: Computer has gone to sleep.]
Devalo has joined #ruby
Immune has quit [Ping timeout: 260 seconds]
wugy has quit []
aryaching has joined #ruby
tdy has quit [Ping timeout: 240 seconds]
AlexxNica has quit [Quit: AlexxNica]
saneax is now known as saneax-_-|AFK
DoubleMalt has quit [Ping timeout: 276 seconds]
jblack has joined #ruby
s2013 has joined #ruby
cpruitt has joined #ruby
mrtg9970 has joined #ruby
hahuang65 has joined #ruby
mrtg9970 has quit [Client Quit]
synthroid has quit [Remote host closed the connection]
tdy has joined #ruby
AlexJakeGreen has quit [Remote host closed the connection]
agent_white has joined #ruby
redpants has joined #ruby
Immune has joined #ruby
prawnzy has joined #ruby
hahuang65 has quit [Ping timeout: 248 seconds]
troulouliou_div2 has quit [Quit: Leaving]
aufi has quit [Quit: Leaving]
erlingur has quit [Ping timeout: 244 seconds]
prawnzy has quit [Ping timeout: 250 seconds]
AlexxNica has joined #ruby
SteenJobs has quit [Quit: SteenJobs]
duderonomy has quit [Ping timeout: 272 seconds]
senayar has quit []
sai__ has quit [Read error: Connection reset by peer]
hobodave has joined #ruby
sai_ has joined #ruby
sai_ has quit [Read error: Connection reset by peer]
JakFrist has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<jeffreylevesque>
can someone help me with my three cases
JakFrist has joined #ruby
Dimik has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
havenwood has quit [Client Quit]
Ishido has joined #ruby
havenwood has joined #ruby
chwbacca has quit [Quit: ERC (IRC client for Emacs 24.5.1)]
r4z has joined #ruby
Ishido has quit [Remote host closed the connection]
Ishido has joined #ruby
wrkrcoop has quit [Quit: wrkrcoop]
mark_66 has quit [Remote host closed the connection]
omphe has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
wrkrcoop has joined #ruby
kitikonti has joined #ruby
xemehc has joined #ruby
Immune has quit [Ping timeout: 260 seconds]
nando293921 has quit [Ping timeout: 265 seconds]
Guest38 has joined #ruby
machinewar has quit [Ping timeout: 265 seconds]
JakFrist has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
JakFrist has joined #ruby
fullofcaffeine has joined #ruby
ichkv has quit [Remote host closed the connection]
fullofcaffeine has quit [Remote host closed the connection]
fullofca_ has quit [Ping timeout: 265 seconds]
fullofcaffeine has joined #ruby
workmad3 has joined #ruby
Immune has joined #ruby
SteenJobs has quit [Quit: SteenJobs]
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
t3ra has joined #ruby
<SeepingN>
`net ad` || return false
Guest54448 has quit [Remote host closed the connection]
replay has joined #ruby
failshell has quit []
tubuliferous_ has quit [Ping timeout: 240 seconds]
erlend has quit [Ping timeout: 265 seconds]
<havenwood>
jeffreylevesque: When you say "check if command can run" what do you mean? The exit status after the command is run or just checking to see if there is such a command?
Devalo has joined #ruby
erlend has joined #ruby
<havenwood>
jeffreylevesque: How about just?: system 'net', 'ads', 'testjoin'
miqlas-H has joined #ruby
the_drow has quit [Ping timeout: 272 seconds]
<jeffreylevesque>
yeah if `net ads testjoin` returns 0, if command could join
tubuliferous_ has joined #ruby
<jeffreylevesque>
but i'm checking if the command has exit code returned
<havenwood>
jeffreylevesque: "system returns true if the command gives zero exit status, false for non zero exit status. Returns nil if command execution fails."
<Papierkorb>
ule: not really. you can walk up the stack though. at some point you're bound to end up in the router or something which will know the URL
omphe_ has joined #ruby
<havenwood>
jeffreylevesque: looks like you have an errant backtick in there
<jeffreylevesque>
whoops forgot to get rid of that
<jeffreylevesque>
but, the windows case is ok sytnax?
<ule>
I have a common class that gets called in multiple urls from the application.. and I need to take a different action if this class gets called from one specific url
dagda1 has joined #ruby
<Papierkorb>
Please revisit your design decision
<ule>
Papierkorb: There are too many calls to it, that passing some extra parameter over all the methods will take forever
<ule>
Papierkorb: yeah.. that's what I was thinking
<Papierkorb>
You can do such magic with the binding-of-caller gem, but I wouldn't want to use it to dynamically find the stack frame of the router to get the URL...
<ule>
Papierkorb: yeah.. I came with PHP + Symfony experience.. there I can call the request object easily.. I thought that I could do something similar with rails
<Papierkorb>
?rails
<ruby[bot]>
Please join #RubyOnRails for Rails questions. You need to be identified with NickServ, see /msg NickServ HELP
<Papierkorb>
ule: ^
<ule>
ohh
<ule>
thanks! I didn't know about this channel
<Papierkorb>
Ruby is a language not bound to any HTTP stuff
codelogix has joined #ruby
<ule>
yeah.. sorry about that
jottr has quit [Ping timeout: 240 seconds]
<Papierkorb>
np
r4z has left #ruby ["Leaving"]
marxarelli is now known as marxarelli|afk
marxarelli|afk is now known as marxarelli
maddmaxx has quit [Quit: Going offline, see ya! (www.adiirc.com)]
codelogix has quit [Ping timeout: 255 seconds]
marxarelli has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Papierkorb>
ule: Ruby/Rails apps are really applications servers, each handling multiple requests. So such "globals" are disliked in the community.
omphe_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Devalo has quit [Remote host closed the connection]
tubuliferous_ has quit [Ping timeout: 255 seconds]
jackjackdripper has quit [Quit: Leaving.]
Devalo_ has joined #ruby
omphe has joined #ruby
jottr has joined #ruby
fullofcaffeine has quit [Remote host closed the connection]
fullofcaffeine has joined #ruby
the_drow has quit [Read error: Connection reset by peer]
harai has joined #ruby
the_drow has joined #ruby
ChiefAlexander has quit [Remote host closed the connection]
hahuang65 has joined #ruby
Devalo_ has quit [Ping timeout: 248 seconds]
s2013 has joined #ruby
Immune has quit [Ping timeout: 260 seconds]
hahuang65 has quit [Client Quit]
nullfxn has quit [Quit: leaving]
fullofcaffeine has quit [Ping timeout: 250 seconds]
banisterfiend has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
banisterfiend has joined #ruby
nando293921 has joined #ruby
coolboy has quit [Remote host closed the connection]
dagda1 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sergio_101 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
JoshS has quit [Quit: Leaving]
<baweaver>
ercx2x: You might just use sqlite3 as a database
<ercx2x>
baweaver: I'm a bit used to PHP and learning rails. One thing I do in PHP say, if I want to have a gallery of lightbox items in many different posts... I would have a PHP file that was an array of different galleries and request whichever one was needed for the post
<ercx2x>
If I want to replicate that in ruby should I store things in a database? I feel that's unnecessary
UserOO7__ has quit [Remote host closed the connection]
<ercx2x>
and I could simply make some .rb file to store the gallery items similar to how I would do it in PHP?
<baweaver>
That's more of just bad design
<baweaver>
it's called hardcoding values
<ercx2x>
I'm not hardcoding
<baweaver>
you can do it in Ruby, sure, but you probably shouldn't
<ercx2x>
I loop thru the values
<baweaver>
not making much sense there
<ercx2x>
I mean, wouldn't it be overly complex to store those gallery items in a database?
<ercx2x>
I'm not too familiar with databases though
wrkrcoop has joined #ruby
cdg has quit [Read error: Connection reset by peer]
cdg has joined #ruby
<baweaver>
Read through a few Rails tutorials like Mike Hartl's one and Rails 4 in Action
<baweaver>
it'll get you through the basics
<ercx2x>
I've read Hartl
<ercx2x>
I know the basics-ish
<baweaver>
because chances are you want someone to be able to modify things without redeploying the code.
t3ra has quit [Ping timeout: 248 seconds]
<ercx2x>
I guess my question is: Do you always store everything that relates to data items (ie images to reference for a lightbox) in a database?
<ercx2x>
and never something like a JSON file?
aesthetikx has quit [Quit: WeeChat 1.4]
<baweaver>
If I ever want to change it, yes.
<ercx2x>
You can change a JSON file as well though
<ercx2x>
and I'd argue it's easier and less complex
<baweaver>
Then do it that way
<baweaver>
but it's still a bad idea
<ercx2x>
Why do you say that?
wethu has joined #ruby
ben______ has joined #ruby
<baweaver>
I'm not going to spend the next half hour convincing you of why you should do something
<baweaver>
you're not particularly interested in it.
<ercx2x>
No, i"m only trying to understand the reasoning
<ercx2x>
I don't think it'd take an hour. Just one sentence would suffice
<baweaver>
I've given you several already.
<ercx2x>
All you said was that you can modify things which is why you would use a database to store those types of items but then I said you can modify things in JSON as well...
be_______ has quit [Ping timeout: 248 seconds]
nikivi has joined #ruby
JakFrist has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
maddmaxx has joined #ruby
<_sfiguser>
thanks baweaver
sczizzo_ has joined #ruby
<zenspider>
rawr
ldnunes has quit [Quit: Leaving]
sczizzo_ has quit [Remote host closed the connection]
machinewar has quit [Remote host closed the connection]
sczizzo_ has joined #ruby
sczizzo_ has quit [Remote host closed the connection]
Beast has quit [Quit: Leaving]
<baweaver>
ercx2x: It won't scale at all, it creates state on the machine which is bad, it won't persist across deployments if you change it live, there are several
<baweaver>
a database keeps the state of an application in a separate place allowing it to properly persist without those concerns.
sczizzo_ has joined #ruby
<baweaver>
easy now often leads to incredible pain later.
<ercx2x>
Alright, that makes more sense to me
SteenJobs has quit [Quit: SteenJobs]
sczizzo has quit [Ping timeout: 240 seconds]
SteenJobs has joined #ruby
JeanCarloMachado has quit [Ping timeout: 265 seconds]
<machinewar>
why is the array returned? just curious would think nil would be returned. from docs "loop returns the "result" value stored in the exception"
FastJack has quit [Remote host closed the connection]
<baweaver>
to be fair though, seeing loop enum.next in the wild is sparse
<havenwood>
i can't think of a use
<machinewar>
baweaver: agreed, I have an array of objects and need to set an attribute on each object the the same attr on the next object. would be trivial recursively with a linked list
<baweaver>
so why not just do objects.each { |o| o.attr = x } ?
<machinewar>
because it would need to be more like objects.each_with_index { |o| o.attr = o[index + 1].attr}
<machinewar>
because it would need to be more like objects.each_with_index { |o| o.attr = objects[index + 1].attr}
<machinewar>
but objects[index + 1] will be nil if end of the array
<baweaver>
what exactly are you trying to do that for?
<machinewar>
work....
<machinewar>
its a database response and some business logic
<baweaver>
ok. but to solve what problem?
<machinewar>
set the end dates of each object to the start_date of the next object - 1
<machinewar>
and nil if there's no next object
Ishido has quit [Remote host closed the connection]
elenatanasoiu has joined #ruby
Ishido has joined #ruby
<machinewar>
there's clearly many ways to do it, but enumerator + loop is pretty simple