relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Fyyr13_ has joined #ruby
YamakasY_ has quit [Ping timeout: 240 seconds]
snuffeluffegus has joined #ruby
eiei has joined #ruby
<RubyPanther>
I like having a little extra delegation, so that things are less coupled
<eiei>
So, I am considering moving away from Ruby for a bit and learning Java so I can learn android dev.
<eiei>
I started learning ruby a while back, and was going to move onto RoR.
<eiei>
But, I am really interested in trying out android dev.
<havenwood>
eiei: Why not use Roboto?
<eiei>
Is this a bad idea?
<RubyPanther>
if I just need the ivar now, but a standard sort of feature request might need a method, then it is better to have the method from the start
<havenwood>
eiei: you might query in #jruby as well
<RubyPanther>
You still need to learn Java to use ruboto
<eiei>
wow.
<RubyPanther>
At least a little bit
<eiei>
Is this legit, aka I could build a full blown app that way just as good as Java?
<RubyPanther>
less, obviously. but you're calling java methods from Ruby
<eiei>
Sigh...
<eiei>
IDK, here is my thing.
<eiei>
I feel I understand ruby pretty nicely, of course still have lots to learn still though.
<RubyPanther>
eiei: It is legit, you can make real apps, no it is not just as good, it runs slower... of course for a Rubyist the dev time is quicker
<eiei>
So, should I take a few months to learn Java and then do SDK thourhg Java?
<RubyPanther>
But Java is one of the basic languages, you should probably learn it even if you're not going to try to remember and use it :)
<eiei>
Or maybe just stick with ruby and give it a shot through ruboto?
<eiei>
RubyPanther: I did do Java in college when I took a CS class.
<RubyPanther>
eiei: just give ruboto a try and get your feet wet :)
<eiei>
I'm familiar with Java, even built a android app in the class.
<eiei>
using the SDK thing.
predator117 has joined #ruby
<RubyPanther>
ruboto uses the SDK for you, and connects jruby to it
toastynerd has quit [Remote host closed the connection]
[gmi] has quit [Read error: Connection reset by peer]
<eiei>
Well, the big problem I see is with the SDK.
<eiei>
I remember it would do everythign in Java.
Rober9393 has joined #ruby
<eiei>
android SDK that is.
<RubyPanther>
like for me I'm making tablet apps, not really "phone" apps, so there is always enough CPU that I jruby is fast enough and I can't tell the difference
<eiei>
Unless I'm confused.
pfg has joined #ruby
<RubyPanther>
eiei: with jruby, the ruby interpreter is in java, so everything is java under the hood, but your app code is in Ruby
nateberkopec has joined #ruby
maroloccio has quit [Quit: WeeChat 0.4.3]
<havenwood>
eiei: the jruby channel is #jruby and its site is http://jruby.org/
<eiei>
Right, but lets say I'm using the android SDK thing. I know there was a feature where you could just "add" a button on the screen. And the code would auto be put in for you.
<eiei>
Wouldn't that be done in Java though?
<bnagy>
although, fair warning, #jruby is not really noob friendly
<bnagy>
it's really mostly a project-internal dev channel
<RubyPanther>
no, that isn't the SDK that must be some tool it comes with. But no, you write it in Ruby.
sailias has quit [Ping timeout: 240 seconds]
predator217 has quit [Ping timeout: 244 seconds]
<eiei>
I'm going to go cook dinner, but IDK.
mojjojo has joined #ruby
<RubyPanther>
Honestly if the difference between the code you write and the code that a framework generates isn't clear, you should just write it all in Java the way you learned
<eiei>
I'm tempted just to delay things and learn Java again. But I worry I will forget all of ruby then too.
<eiei>
Even though both are OOP.
srji_ has joined #ruby
<bnagy>
:/
<bnagy>
Java is what OOP becomes if you don't guard against overengineering insanity
mercwithamouth has joined #ruby
<bnagy>
its main function is as a salutory lesson
<havenwood>
<3 JRuby
<RubyPanther>
Java was originally intended to be run on special CPUs where the Java bytecode would be like ASM, so it is no surprise that for the uses it has now it is over-engineered
nateberkopec has quit [Ping timeout: 240 seconds]
<bnagy>
well I'm all in favour of the JVM
<bnagy>
just not Java
mojjojo has quit [Client Quit]
<RubyPanther>
well android gives you a different VM, but keeps the Java lol
srji has quit [Ping timeout: 252 seconds]
<eiei>
I just want to build an android app is all, and am tempted just to relearn Java to do so, because that is how I was familiar building the last android app.
<eiei>
But, that was 2 years ago I think.
<eiei>
So, I really need to relearn Java.
mojjojo has joined #ruby
burgess has quit [Quit: ^zzz]
werdnativ has joined #ruby
axsuul has quit [Ping timeout: 264 seconds]
burgess has joined #ruby
matti_ is now known as matti
matti has quit [Changing host]
matti has joined #ruby
newbie1r has joined #ruby
mlpinit has joined #ruby
jwest has quit [Quit: WeeChat 0.4.1]
bbloom has joined #ruby
hiyosi has joined #ruby
lolmaus has quit [Ping timeout: 240 seconds]
joelroa has joined #ruby
oneawayman has quit [Ping timeout: 252 seconds]
hiyosi has quit [Ping timeout: 240 seconds]
S0da has joined #ruby
aspires has joined #ruby
ankushio has joined #ruby
yasushi has joined #ruby
<ankushio>
Any recommendations for Comprehensive books on learning Ruby
lw has quit [Ping timeout: 244 seconds]
duggiefresh has quit [Remote host closed the connection]
pskosinski_ has joined #ruby
duggiefresh has joined #ruby
bbloom has quit [Quit: Computer has gone to sleep.]
jjbohn is now known as jjbohn|afk
jwest has joined #ruby
lantis has quit [Ping timeout: 244 seconds]
lw has joined #ruby
yasushi has quit [Ping timeout: 240 seconds]
ndrei has quit [Ping timeout: 265 seconds]
marcdel has quit []
i8igmac has quit [Ping timeout: 244 seconds]
pskosinski has quit [Ping timeout: 265 seconds]
ankushio has quit [Quit: Leaving...]
momigi has joined #ruby
whowantstolivefo has joined #ruby
duggiefresh has quit [Ping timeout: 244 seconds]
tvw has quit []
jjbohn|afk is now known as jjbohn
pfg has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Geniack has quit [Disconnected by services]
Geniack_ has joined #ruby
<ddd>
The Well-Grounded Rubyist
<ddd>
That and the Programming Ruby 1.9/20 book
Sawbones has joined #ruby
cjsarette has joined #ruby
bbloom has joined #ruby
<Nyyx>
eiei: java isn't that hard, all you really need to know is how to read their docs
Hanmac1 has joined #ruby
angoragoats has joined #ruby
_lynX has joined #ruby
<ddd>
I was in a class for java and found it a bit difficult with the graphics, but beyond that it was *fairly* straight forward
Hanmac has quit [Ping timeout: 240 seconds]
Speed has quit [Quit: When two people dream the same dream, it ceases to be an illusion.]
lyubent has joined #ruby
<centrx>
Ja...va...?
<bnagy>
no, it's je vais
<centrx>
ohhhh
<centrx>
merci
<bnagy>
prego
peret has joined #ruby
koell has quit [Ping timeout: 240 seconds]
lolmaus has joined #ruby
yubrew has joined #ruby
albedoa has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
HelloWorld has joined #ruby
baroquebobcat has joined #ruby
markalanevans has joined #ruby
BuSerD has joined #ruby
<markalanevans>
Hey guys, i have a sinatra app. its littered w/ "require" statements.
<markalanevans>
For non gems
<markalanevans>
and bundler for gems
<markalanevans>
whats a better way to organize file includes?
jjbohn is now known as jjbohn|afk
yubrew has quit [Read error: Operation timed out]
<bnagy>
you can require all your stuff in one .rb and then require that
<bnagy>
but I don't know anything about bundler
<markalanevans>
hm. For example, php has composer
<bnagy>
uh.. ok?
<centrx>
markalanevans, bundler is good for gem dependency management
<markalanevans>
I can't believe there isn't a nice way to manage dependencies in ruby
<markalanevans>
Right, but what about the rest of all my classes.
<centrx>
markalanevans, What is your goal with this?
<markalanevans>
I have a few PHP apps and composer cleans all that up.
<ddd>
err? gems do that. and you don't need bundler for that. Bundler just makes specification easier without having to have it all in a gem (and its deps lists)
<centrx>
markalanevans, You might be looking for autoload
<bnagy>
oh please no
<bnagy>
bundler is already ditzy enough without adding autoload
<markalanevans>
i'm not talking about gems. ddd. I"m talking about a nice organize way to load all the classess and files that i need for my app to run, outside of gems.
<ddd>
wow, first time i've heard autoload advocated
<bnagy>
ddd: centrx is tainted by rails
<xybre>
like.. "require"?
<ddd>
markalanevans use an .each on a Dir.glob
Xeago has quit [Remote host closed the connection]
<markalanevans>
it just makes it easy to manage ruby gems
<bnagy>
hahaah only PHP could be inspired by npm :D
<ddd>
morph as needed. put in your config
<xybre>
markalanevans: it does if you make your app a gem
<ddd>
singular example, sorry
<markalanevans>
xybre: so if i made my app a gem, don't i still have to have some file that does all the "loads/requires" etc
jzig has quit []
<ddd>
bnagy ahh. makes sense (rails comment). I started with rails, didn't grok it because i didn't know ruby, stopped rails, learned ruby, tried to go back to rails and now I don't really like it. my tricks are non-rails centric
<centrx>
markalanevans, So instead of doing: { "require": { "monolog/monolog": "1.2.*" } } you just do: require 'monolog/monolog'
<bnagy>
a common pattern is to make the requireable file mygem.rb basically just an empty shell that does all the internal requires
jjbohn|afk is now known as jjbohn
<ddd>
hahah see that centrx? centric, get it? bwahahah! Now, bitcoin me 6 bitcoins for the REALLY bad joke
<centrx>
You are very wise
<centrx>
ddd, Have you heard of Bitcom?
<ddd>
yes
<centrx>
ddd, Do you like model trains, free lunches, and Danish butter cookies?
<ddd>
amazingly, yes to all 3
<xybre>
markalanevans: What is your use case? Can I get some more detail?
<centrx>
ddd, So join my new channel #bitcom !!
<markalanevans>
Ok. Well it sounds like i'm correct, in that there isn't some gem or tool that is the defacto way to load all of the classess/files in my app
mojjojo has quit [Quit: mojjojo]
<centrx>
markalanevans, Why do you need a tool for it, you just create a file
<ddd>
channel purpose? :)
mikepack has quit [Ping timeout: 252 seconds]
AlSquire has quit [Quit: This computer has gone to sleep]
blackmesa has quit [Ping timeout: 264 seconds]
<xybre>
"load all the things" isnt a solution to dependencies. but Rails does do something of the sort.
baroquebobcat has quit [Quit: baroquebobcat]
lw has quit [Quit: s]
<xybre>
In any language its a bad idea though.
<markalanevans>
centrx: mostly for simplicity. For all the reasons that php's composer exists.
Fyyr13_ has joined #ruby
<centrx>
ddd, Evangelizing the new Bitcom Product! We aren't sure what it is yet, but we know who our glorious leader is, Dorian Nakamoto
<ddd>
stop trying to apply PHP thinking to ruby
<ddd>
centrx hehehe
<markalanevans>
ha
<ddd>
no, you laugh. i'm being serious
eMBee has left #ruby [#ruby]
<centrx>
markalanevans, I don't understand. In Composer, you create a file where you "require" the dependencies. In Ruby, you do the same thing, but you don't need any extra tool to do it.
<centrx>
xybre, Rails has its own version of autoload
koell has joined #ruby
<xybre>
centrx: right
<xybre>
Its nasty in Rails too
pskosinski_ is now known as pskosinski
robustus has quit [Read error: Connection reset by peer]
<markalanevans>
Ok. So lets say i'm goign to just have a single file where i define all my includes
<markalanevans>
why would i use load vs require
<markalanevans>
your example used load
<tongcx>
hi guys, in file 'main.rb' i required 'one.rb', and in 'one.rb' i required a module Test, does Test also got poured into global namespace of 'main.rb'?
bw_ has quit [Ping timeout: 264 seconds]
<bnagy>
tongcx: if you mean you defined a module Test then yes
intnsity has joined #ruby
Fyyr13_ has quit [Ping timeout: 240 seconds]
intnsity has left #ruby ["Leaving"]
<tongcx>
bnagy: that seems insane to me, every module will got poured into global namespace even if it was required by some distant module that I required?
<bnagy>
tongcx: require is pretty much like just typing all the source from the required file into the requiring file
aep has quit [Ping timeout: 264 seconds]
<bnagy>
tongcx: where would you like them to be namespaced?
<bnagy>
most modules manage their own namespaces, if they're written by people that can code
<xybre>
markalanevans: require makes sure you only load a file once. load doesnt.
<markalanevans>
so why use load?
<xybre>
Dont.
<markalanevans>
ok
<tongcx>
bnagy: something like nodejs seems very good, you have total control
<tongcx>
bnagy: things are never poured into global namespace
* bnagy
rolls eyes
<bnagy>
ok whatever you say
axl_ has joined #ruby
<bufferloss>
tongcx, so go back to node.js
<bnagy>
how do you get a reference to them them?
shevy has quit [Ping timeout: 240 seconds]
robustus has joined #ruby
nateberkopec has joined #ruby
<bnagy>
oh WAIT I guess they have a stub that's available from the global namespace!
carif has joined #ruby
bw_ has joined #ruby
axsuul has joined #ruby
nateberkopec has quit [Read error: No route to host]
<tongcx>
bufferloss: no offence, man, just wondering why they designed it so
nateberkopec has joined #ruby
aep has joined #ruby
mojjojo has joined #ruby
<bufferloss>
just wondering why you wonder that
<xybre>
tongcx: You need to namespace your own objects :)
<bnagy>
tongcx: it's just the ruby OO model. Toplevel -> namespaces
<xybre>
Node does it that way because JS is so awful about it
<bnagy>
you have to have able to get to the Module object from somewhere
<tongcx>
bnagy: i c, so the best practice is to put my code under some module and hopefully no other people is using the same name?
<bnagy>
IRL 'global namespace' pollution isn't really a problem
<tongcx>
bnagy: i c, so the best practice is to put my code under some module and hopefully no other people is using the same name?
<bnagy>
yeah if someone else is using the same module name you've got an issue
<xybre>
JS tries to put literally everything in global. node needed to do that to build projects of appreciable complexity. Ruby namespaces everything by convention and its very easy to do correctly so its not as much of an issue.
marcdel has joined #ruby
bbloom has quit [Quit: Computer has gone to sleep.]
Sawbones has quit [Remote host closed the connection]
carif has quit [Quit: Ex-Chat]
<xybre>
tongcx: If its a gem, you'll know, if its a private app you'll know. So yes.
<tongcx>
xybre: i c, makes sense
Sawbones has joined #ruby
nateberkopec has quit [Ping timeout: 269 seconds]
bbloom has joined #ruby
MrJoshua has quit [Quit: MrJoshua]
<xybre>
tongcx: I totally see the utility of namespacing files, but since its so ingrained in Ruby development to name everything by hand, its actually rarely an issue.
Axsuul_ has joined #ruby
axsuul has quit [Ping timeout: 264 seconds]
Axsuul_ has quit [Read error: Connection reset by peer]
hiyosi has joined #ruby
axsuul has joined #ruby
xmon has joined #ruby
<xybre>
There's some pros and cons to each. The implicit namespacing means you can't *see* it, you have to know it, whereas explicitly you have to see it and know it and can control it.
<bnagy>
also, ruby stuff can be spread across many files more easily with this approach
<Radar>
tongcx: I doubt that anyone else is going to use the "Tongcx" module if that's what you're asking ;)
<bnagy>
not saying there's no downside, but I can implement 5 classes that are part of MyProject in 5 separate files
Sawbones has quit [Ping timeout: 252 seconds]
<Radar>
The upside with namespacing in Ruby is that my code won't override your code :)
<bnagy>
I wouldn't be totally opposed to require const, fname
<bnagy>
but I've just never had a need for it
<Radar>
bnagy: Sounds similar to ActiveSupport::AutoLoad?
<Radar>
Autoload*
<Radar>
autoload Const, filename
<bnagy>
orly? sandboxes everything in Const ?
james_d_h has joined #ruby
<Radar>
no, it loads that file if it can't find that const
<Radar>
Actually it's autoload :Const, filename
<Radar>
The code is gnarly
<bnagy>
oh, no I mean something that enforces a namespace
<Radar>
Oh, that is called "coding standards"
aspires has quit []
shevy has joined #ruby
<xybre>
Yeah, even with coding standards it doesn't catch everything.
<bnagy>
so all of the required code would have to be accessed by Sandbox::TheirTopNamespace
<xybre>
But still, its less than 5% of the cases so I haven't worried about it too much in Ruby.
<bnagy>
ditto
<xybre>
But I'd still like the possibility.
<bnagy>
you can fake it with instance_evaling into a module I think
<bnagy>
I think what I have in my head more or less is Sandbox.instance_eval File.read('foo.rb') tbh :/
<xybre>
bnagy: Pretty much. Nasty though. And probably slow.
<tongcx>
hi guys, say i want to write a module to talk to database in my app, should i write a module with methods initializing and talking to db, or should i write a class and then new it and put it in some namespace in setup code?
<xybre>
And there might be side effects.
orangey has joined #ruby
<orangey>
hello all!
jjbohn is now known as jjbohn|afk
<bnagy>
tongcx: if it needs state it should be a class. DB connections usually do ( address, port or filename or whatever )
<CorySimmons>
xybre bnagy: Thanks :)
<tongcx>
the state can also be local variable in a module, right?
timonv has quit [Ping timeout: 264 seconds]
mehlah has quit [Quit: Leaving...]
<Radar>
uh
<tongcx>
bnagy: the difference seems to be do I need more than one connection
<Radar>
why
<Radar>
would you
<Radar>
write your own DB connection code?
<CorySimmons>
Thanks guys, works perfect
<Radar>
When pg, mysql, etc. already exist?
<tongcx>
Radar: no, just some helper function
francisfish has quit [Ping timeout: 265 seconds]
<Radar>
tongcx: Use the Sequel library.
<Rober9393>
Anyone has a beta invite for Atom editor left ? :-p
<bnagy>
tongcx: it's always possible to write code like an idiot, yes
<bnagy>
but if it needs state, it should be a class
<tongcx>
bnagy: then it new it in setup and put it under some namespace?
Emmanuel_Chanel has quit [Ping timeout: 265 seconds]
<bnagy>
I am not looking at your code, nor can I read minds
<bnagy>
so I can't answer that question
<tongcx>
Radar: sorry, i'm talking to neo4j
bbloom has quit [Quit: Computer has gone to sleep.]
* Radar
suddenly finds the carpet more interesting
<tongcx>
bnagy: i mean if it's a class, then there are two ways to let other parts of app access it, 1. put it under some namespace 2. pass it to everyone who needs it
<tongcx>
bnagy: do you think 1 is better?
<Radar>
wat
<Radar>
Put it under some namespace. This cannot still be up for debate :(
<Radar>
Not namespacing your code is careless.
pfg has joined #ruby
j0xf has quit [Quit: Leaving.]
shevy has quit [Ping timeout: 252 seconds]
bbloom has joined #ruby
<tongcx>
Radar: yea, alternative is to pass it to a lot of function call
chrisseaton has joined #ruby
<tongcx>
Radar: i feel the alternative is too verbose
<tongcx>
Radar: but it has less side effects
Emmanuel_Chanel has joined #ruby
shevy has joined #ruby
<Radar>
tongcx: you're still thinking with functions, which is nodejs speak
<bnagy>
I would normally just do db = MyNotInventedHereConnector.new('localhost:31337') then use db for whatever I need it for
<Radar>
+1 bnagy
IceDragon has quit [Quit: Space~~~]
<tongcx>
bnagy: yea, how do other parts access db?
<bnagy>
they make their own connections
<tongcx>
Radar: interesting, there is a neo4j gem, I installed it through pacman
<tongcx>
bnagy: aha, i c
<tongcx>
bnagy: thanks
BuSerD is now known as BuSerD_zzzz
BuSerD_zzzz is now known as BuSerD
<bnagy>
or otherwise I make one object that does ALL the DB work, and have it talk to Queues
<bnagy>
if the DB is unthreadsafe or slow or whatever
j0xf has joined #ruby
BuSerD is now known as BuSerD_zzzz
<bnagy>
but this is kind of All Been Done
<tongcx>
bnagy: that seems very reasonable
yubrew has joined #ruby
<bnagy>
IRL most of my DB talkers are totally separate processes
<bnagy>
I do mostly distributed stuff
j0xf has quit [Client Quit]
<bnagy>
so the Queue model abstracts out well for that
rjk808 has joined #ruby
<bnagy>
anyway concurrent DB access is hard. Don't do it yourself, you are guaranteed to mess it up
<bnagy>
jhass: is there actually a perf boost for using unix sockets? I haven't seen them IRL for many years ( since local networking gor fixed )
<bnagy>
or is it just to get the ACLs on the socket?
<tongcx>
hi guys, what does 'attr_accessor' do in under a module, not a class
<orangey>
Ok, another question.
<tongcx>
is there any usage of that?
<orangey>
how do I change the rack_env / rails_env to production?
<jhass>
bnagy: I'm not sure how optimized the current kernel is for loopback connections, but in theory there's less network stack overhead. ACLs is a reason too of course
<orangey>
not just a shell variable, eh?
werdnativ has quit [Quit: werdnativ]
<orangey>
oh, it is..
toastynerd has joined #ruby
<jhass>
orangey: btw there's #RubyOnRails for rails questions
<orangey>
jhass: I'm guessing ruby =/= rails?
<orangey>
This is the problem with not being a proper programmer ; )
<jhass>
rails is a framework running on ruby
CorySimmons has left #ruby [#ruby]
<bnagy>
tongcx: it would create a reader on anything the module is included into
<tongcx>
bnagy: i say, only for mixin purpose
<bnagy>
*on instances of any Class the module is included into, to be clear
tylersmith has joined #ruby
<bnagy>
attr_* create instance methods. Modules are instances of Module, but they can't be instantiated
<bnagy>
so instance methods make no sense for them
jjbohn|afk is now known as jjbohn
axsuul has quit [Ping timeout: 241 seconds]
sski has joined #ruby
<bnagy>
this is usually where someone feels compelled to be confusing by pointing out that class / module methods are really instance methods anyway
j0xf has joined #ruby
<bnagy>
and it's turtles all the way down
<tongcx>
bnagy: right, seems mattr_accessor is rails extension
pu22l3r has joined #ruby
HelloWorld has quit [Quit: Leaving]
sparrovv has quit [Remote host closed the connection]
<bnagy>
Rail - making Ruby more insane since 2008!
<shevy>
:D
godd2 has joined #ruby
marcdel has quit [Ping timeout: 265 seconds]
<godd2>
hello all
Fyyr13_ has joined #ruby
<bnagy>
godd2: #rubyonrails
_lynX has quit [Quit: Leaving]
axsuul has joined #ruby
<godd2>
bnagy: lol what about it?
<bnagy>
unless by some incredible coincidence you're NOT here to talk about rails
<bnagy>
cause it seems everyone else is, today
<godd2>
lol oh no, Im just chillin.
marcdel has joined #ruby
<godd2>
I FINALLY got Ruby to play arbitrary made-up PCM data through FFI on my windows box so I'm takin a break
<bnagy>
fine, as long as you're not planning to autoload Chill or bundle install Chill ~>1
<bnagy>
ooh windows FFI now we're talking
<godd2>
nah my brain is swarming with attach_function :chill, [:uint, :string], :pointer
Hobogrammer_ has joined #ruby
<godd2>
I couldn't find any existing Ruby solution to play multiple asynchronous audio streams, so I embarked on doing it myself. I got the base work done, but it's not polished or extensible yet
yfeldblu_ has joined #ruby
shevy has quit [Ping timeout: 240 seconds]
<bnagy>
almost nobody works on native windows stuff
chrisseaton has quit []
Fyyr13_ has quit [Ping timeout: 252 seconds]
Hobogrammer has quit [Ping timeout: 252 seconds]
shevy has joined #ruby
<centrx>
Win...dows?
<Radar>
I'm currently looking out a set right now. Sun's gone down at SFO and so there's not much to see besides more airport.
Mongey has joined #ruby
<Radar>
centrx: I think that's what bnagy and godd2 are talking about, anwyay
<godd2>
something, something, defenestration
Hanmac has joined #ruby
jrhe has joined #ruby
axsuul has quit [Ping timeout: 240 seconds]
Mongey has quit [Client Quit]
<centrx>
You guys are a bunch of wise-asses today
<centrx>
s/wise-asses/wise-guys
<popl>
s/ today//
axsuul has joined #ruby
<centrx>
s/bunch/potatoe
yfeldblum has quit [Ping timeout: 264 seconds]
<godd2>
s/potatoe/potahto
nateberkopec has joined #ruby
<RubyPanther>
if you use autoconf and regular C stuff like Ruby API, apache apr, or glib/Gtk then you can compile on windows without worry or consideration
<jrhe>
Is it bad practice to assert that a method returns an array?
<RubyPanther>
you plug your nose, push the button, and then it is ready
Hanmac1 has quit [Ping timeout: 240 seconds]
Mongey has joined #ruby
<jrhe>
Should I be asserting that it returns something enumerable instead
mojjojo has quit [Quit: mojjojo]
<jhass>
jrhe: assert that the method you want to call is there. Or just call it
<bnagy>
jrhe: or just ducktype
<RubyPanther>
jrhe: you're generally supposed to check with respond_to? :to_ary
<RubyPanther>
if it has that that it is explicitly claiming to be some sort of "real" array
Fyyr13_ has joined #ruby
<jrhe>
Case in point, I have a method which fetches an array of Course objects using mechanize and scraping. I have a method called Course.all but then I'm not sure which assertions should be in the test for that method.
<jrhe>
RubyPanther: I'm not asserting any sort of order on it, it just has to act like an array so I guess :to_ary is what I want.
<RubyPanther>
jrhe: if you duck type then the test will survive any refactoring, but a lot of people don't duck type in tests
nateberkopec has quit [Ping timeout: 241 seconds]
DrShoggoth has joined #ruby
<jrhe>
RubyPanther: Ducktyping would be your test for respond_to? :to_ary right?
<RubyPanther>
yeah
<jrhe>
Cheers :)
Sawbones has quit [Remote host closed the connection]
monzie has joined #ruby
<monzie>
Hello all
<pontiki>
hey folkes
yfeldblu_ has quit [Read error: Connection reset by peer]
Fyyr13_ has quit [Ping timeout: 252 seconds]
yfeldblum has joined #ruby
Sawbones_ has joined #ruby
ankushio has joined #ruby
<ankushio>
Is there any difference b/w a = String.new("hello") and a = String("hello")
evenix has quit [Remote host closed the connection]
thomasxie has joined #ruby
pu22l3r has quit [Remote host closed the connection]
axsuul has quit [Ping timeout: 240 seconds]
shevy has quit [Ping timeout: 240 seconds]
toastynerd has quit [Remote host closed the connection]
axl_ has quit [Quit: axl_]
lw has joined #ruby
werdnativ has joined #ruby
shevy has joined #ruby
jjbohn is now known as jjbohn|afk
Sawbones_ has quit [Remote host closed the connection]
<jrhe>
ankushio: I don't believe there should be. Do you know what they both mean?
<RubyPanther>
ankushio: String() will convert
<RubyPanther>
>> String.new(1)
<eval-in>
RubyPanther => no implicit conversion of Fixnum into String (TypeError) ... (https://eval.in/116234)
<ankushio>
I understand that the .new class method creates and returns a new object
<ankushio>
I was not sure what the String() does
Avahey_ has joined #ruby
<RubyPanther>
There isn't Number() but there is Integer() and Float()
<shevy>
see how old RubyPanther is
<shevy>
he is the only one to remember :)
<ankushio>
RubyPanther: Where are these defined?
<ankushio>
RubyPanther: are they part of the class definition?
<RubyPanther>
ankushio: I'm not sure, I can't get ri to tell me about String() I had to poke it with a stick in irb
<ankushio>
RubyPanther: oh, ok
Sawbones has quit [Ping timeout: 252 seconds]
<RubyPanther>
but Integer() and Float() are commonly used because they raise an exception on mixed data like "1a" whereas #to_i #to_f will take the 1 and ignore the rest
<RubyPanther>
String I don't see the point, except for example in a case statement where you're testing with Integer() or Float()
<ankushio>
RubyPanther: ok. I am just curious as to understand "what" exactly are Integer() or Float(). Are they built-in functions or something?
<RubyPanther>
yeah, from the Float and Integer classes
mgomezch_ has joined #ruby
<RubyPanther>
hpricot has an example of it in a C extension, with Hpricot()
<jhass>
Integer() and Float() are methods on Kernel
not_a_guest has quit [Quit: Connection closed for inactivity]
Hanmac1 has joined #ruby
eka has joined #ruby
Hanmac has quit [Ping timeout: 244 seconds]
<jrhe>
Is there an rspec matcher for checking if an array of things matches a condition? I wan't to check an entire array of objects are of a given type.
<jrhe>
Perhaps it would be more appropriate to just check one.
axsuul has joined #ruby
Nyyx has joined #ruby
jjbohn|afk is now known as jjbohn
senayar_ has joined #ruby
<werdnativ>
jrhe: array.all? { |i| i.is_a? Type }.should be_true
fluxxed has quit [Ping timeout: 245 seconds]
<jrhe>
werdnativ: Nice way of doing that with the expect syntax?
<werdnativ>
yeah, you can do that too.
senayar has quit [Ping timeout: 264 seconds]
<jrhe>
werdnativ: Ignore me. Only just realised how you did it. I thought you were looping and checking each rather than using all?
<werdnativ>
yeah, all? just reduces the array to a true or false...
<jrhe>
and an array of trues is true?
<shevy>
all or nothing!
<werdnativ>
jrhe: not exactly. It depends what you put in the block. It should return a boolean for each item. [true, true].all? { |i| i.is_a? Fixnum } #=> false
BuSerD has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jrhe>
undefined method `true?' for true:TrueClass
alexju has joined #ruby
<werdnativ>
ah, sorry == true
<jrhe>
I guess I can reduce on the array with :&
<werdnativ>
or ` be true`
<jrhe>
How is that different from be_true ? Sorry I'm a total rspec noob. its stuff like this which has been putting me off learning it (that and laziness)
<werdnativ>
jrhe: be_true tries to do `true.true?` which is not a thing.
<werdnativ>
true is a singleton TrueClass
<werdnativ>
it doesn't have a .true? method which is what rspec's be_true translates to.
<jrhe>
Ahh right. So be_true is checking for True. be true is checking for truthiness?
Hanmac has joined #ruby
<werdnativ>
however `x should be true` compares object identity.
<werdnativ>
object1 should be object1 # same instance
<werdnativ>
object1 should == object2 # compares identity
<werdnativ>
sorry, * compares value
<werdnativ>
"be" compares identity, "==" or "eq" compares value.
<jrhe>
sweet, gotcha. Cheers for your help!
Hanmac1 has quit [Ping timeout: 240 seconds]
<werdnativ>
"be_something" calls ".something?" and sees if it's true.
<werdnativ>
no prob.
thomasxie has quit [Remote host closed the connection]
thomasxie has joined #ruby
bbloom has quit [Quit: Computer has gone to sleep.]
cover_ has joined #ruby
Deele has quit [Ping timeout: 240 seconds]
axl_ has joined #ruby
_mtr has joined #ruby
nateberkopec has joined #ruby
toretore has quit [Quit: This computer has gone to sleep]
cover has quit [Ping timeout: 265 seconds]
morenoh149 has quit [Ping timeout: 244 seconds]
aspires has quit []
axsuul has quit [Read error: Connection reset by peer]
nateberkopec has quit [Ping timeout: 240 seconds]
foredoomed has joined #ruby
james_d_h has joined #ruby
timonv has joined #ruby
senayar_ has quit [Remote host closed the connection]
Jdubs has joined #ruby
jjbohn is now known as jjbohn|afk
zorak has joined #ruby
ctp has quit [Ping timeout: 244 seconds]
bogeyd6 has joined #ruby
thomasxie has quit [Ping timeout: 264 seconds]
timonv has quit [Ping timeout: 240 seconds]
Raboo has quit [Ping timeout: 240 seconds]
Hanmac1 has joined #ruby
mgorbach has quit [Max SendQ exceeded]
mgorbach has joined #ruby
Hanmac has quit [Ping timeout: 264 seconds]
markisonfire has quit [Quit: markisonfire]
Jamo_ is now known as Jamo
TripTastic has joined #ruby
germsvel has quit []
JBreit has quit [Ping timeout: 252 seconds]
jjbohn|afk is now known as jjbohn
TripTastic is now known as JBreit
yubrew has joined #ruby
cover_ has quit [Changing host]
cover_ has joined #ruby
francisfish has joined #ruby
cover_ is now known as cover__
cover__ has quit [Quit: Gone]
cover has joined #ruby
NicholasFlamel has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
nateberkopec has joined #ruby
werdnativ has quit [Quit: werdnativ]
yubrew has quit [Ping timeout: 240 seconds]
mlpinit has quit [Remote host closed the connection]
ValicekB has quit [Read error: Operation timed out]
cjsarette has quit [Ping timeout: 245 seconds]
<Oog>
look on the left
lyubent has quit [Quit: Leaving.]
<Oog>
llol there is a +14
<Oog>
line islands...
<Oog>
very left right below center of map
<RubyPanther>
You shouldn't even be adding up the hours to get 25, all you have to do is figure out the local time, round, check if it is 0
pfg has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
cjsarette has joined #ruby
<Oog>
i dont want to loop through every user in the db though right?
jetblack has joined #ruby
<weaksauce>
oh wow
<Oog>
i store the gmt offset in teh timezone field of each user
<weaksauce>
never would have guessed that
<RubyPanther>
You can use date/time math in SQL, it is part of the language
diegoviola is now known as Guest59671
<Oog>
ah
<Oog>
or i just realized i could loop through the timezones
<Oog>
and if it is midnight local ime query for thos eusers
<Oog>
thats what ill do
<Oog>
25 timezone calculations will be fast
<weaksauce>
so what is everyone's preference on version managing?
<RubyPanther>
if you're using postgres, you can make columns that are timestamp with time zone, and it is pretty easy. You don't even have to calculate
<Oog>
RubyPanther: i dont want to mess with the db - i'm storing the timezone as a string right now
<Oog>
probably not the best
<RubyPanther>
Oog: You can give the zone to the db as a string also
<weaksauce>
any reason RubyPanther? link for the weary ruby traveler?
jetblack_ has quit [Ping timeout: 265 seconds]
rjk808 has quit []
<Oog>
hhmm ok ill look at it
<RubyPanther>
weaksauce: rvm is out of fashion for various reasons, rbenv uses "shims" that hand off to the correct program, chruby munges your PATH. They all work.
<RubyPanther>
some people hate shims (they're just short scripts, I dunno why) some people don't like their PATH munged
<weaksauce>
i see. do you use any of the rbenv add ons that make it use bundler by default or do you just relegate yourself to use bundle exec ruby every time
<weaksauce>
or am I off base about hta
<weaksauce>
that*
<RubyPanther>
weaksauce: I don't use any addons, and I don't have to run bundle exec either, because the apps know to run their Bundle.require stuff
hello has joined #ruby
<weaksauce>
is rails one of those?
<RubyPanther>
well, I do use ruby-build for installation
<weaksauce>
oh
<RubyPanther>
yeah, rails works transparently
Hanmac has joined #ruby
fgo has quit [Remote host closed the connection]
<RubyPanther>
it was only like, a few months when bundler first came out that you had to do the bundle exec stuff
NicholasFlamel has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<weaksauce>
that's good to know
<weaksauce>
I will try to migrate over to the good stuff. I am a little irritated with rvm not letting me script it.
weaksauce has left #ruby [#ruby]
fgo has joined #ruby
Hanmac is now known as 7JTAAI9OQ
Hanmac has joined #ruby
ScalaClient has joined #ruby
Oog is now known as 1JTAANIGS
mlpinit has joined #ruby
mlpinit has quit [Ping timeout: 244 seconds]
Hanmac has quit [Ping timeout: 244 seconds]
george2 has quit [Excess Flood]
Beoran_ has quit [Excess Flood]
Guest59671 has quit [Quit: WeeChat 0.4.3]
xibalba has quit [Excess Flood]
xibalba_ is now known as xibalba
xibalba has quit [Changing host]
xibalba has joined #ruby
Beoran_ has joined #ruby
hello has quit [Remote host closed the connection]
hello has joined #ruby
gnephiak has joined #ruby
yarou has quit [Excess Flood]
danshult_ has quit [Excess Flood]
kennym has quit [Excess Flood]
stephenmac7 has quit [Write error: Connection timed out]
UebaUobaUba has quit [Write error: Connection reset by peer]
matchaw has quit [Write error: Connection timed out]
Jdubs has quit [Write error: Broken pipe]
zorak has quit [Excess Flood]
george2 has joined #ruby
yarou_ has joined #ruby
zorak_ has joined #ruby
sepp2k1 has quit [Read error: Connection reset by peer]
machuga has quit [Excess Flood]
machuga has joined #ruby
i8igmac has quit [Ping timeout: 265 seconds]
kennym1 has joined #ruby
danshultz has joined #ruby
mikepack has quit [Remote host closed the connection]
nateberkopec has joined #ruby
Adran has quit [Quit: Este é o fim.]
nateberkopec has quit [Ping timeout: 240 seconds]
mary5030 has quit [Remote host closed the connection]
burgess has quit [Quit: ^zzz]
pu22l3r has joined #ruby
yubrew has joined #ruby
ValicekB_ has joined #ruby
decoponio has joined #ruby
yubrew has quit [Ping timeout: 240 seconds]
orangey has left #ruby [#ruby]
The_Doctor is now known as Adran
weaksauce has joined #ruby
Dreamer3 has quit [Ping timeout: 252 seconds]
Fyyr13_ has joined #ruby
diegovio1 has quit [Quit: WeeChat 0.4.3]
ValicekB_ is now known as ValicekB
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
camt has joined #ruby
pu22l3r has quit [Remote host closed the connection]
Fyyr13__ has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
dapz has quit [Ping timeout: 264 seconds]
<1JTAANIGS>
Sun, 09 Mar 2014 01:00:00 -0500 should == Sun, 09 Mar 2014 00:00:00 GYT -04:00 right?
Fyyr13__ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
<tongcx>
hi guys, i have a script and i want to use 'irb' and just copy paste that script to irb console
Fyyr13_ has quit [Read error: Connection reset by peer]
<tongcx>
then i can play with things
<tongcx>
is there a easier way than copy paste?
Fyyr13_ has joined #ruby
<centrx>
Do load 'filename'
Dreamer3 has joined #ruby
bufferloss has left #ruby ["Leaving"]
<tongcx>
centrx: thanks
francisfish has joined #ruby
gigs has joined #ruby
circuit has joined #ruby
<tongcx>
centrx: what's diff require vs load vs include?
jack_rabbit has quit [Quit: SIGSEGV (core dumped)]
<mnemon>
1JTAANIGS: -5 01:00 = -4 02:00
<centrx>
tongcx, require will look in your LOAD_PATH, and will not load the file again if it iwas already loaded
toastynerd has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13__ has joined #ruby
<centrx>
tongcx, include is to include modules within a class, completely different
<tongcx>
centrx: i c, thanks
Fyyr13__ has quit [Read error: Connection reset by peer]
<hello>
Howdy
kitak has joined #ruby
Fyyr13_ has joined #ruby
evenix has quit [Remote host closed the connection]
<tongcx>
centrx: if i have 'a=5' in some a.rb, how could i do 'irb a.rb' and then stop at prompt with variable 'a' exist and equal 5?
evenix has joined #ruby
emergion has joined #ruby
francisfish has quit [Ping timeout: 240 seconds]
gigs is now known as _gigs_
Hanmac has joined #ruby
Avahey_ has quit [Quit: Connection closed for inactivity]
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13__ has joined #ruby
amclain has quit [Quit: Leaving]
<centrx>
tongcx, "stop at prompt with variable" ?
<centrx>
tongcx, The variablesin the file should be @instance_variables
meatherly has quit [Remote host closed the connection]
Fyyr13__ has quit [Read error: Connection reset by peer]
<tongcx>
centrx: i would like sth like literally run a.rb in irb
Fyyr13_ has joined #ruby
<tongcx>
centrx: like line by line
meatherly has joined #ruby
<tongcx>
centrx: then i can start typing stuff at the end of running that script
7JTAAI9OQ has quit [Ping timeout: 264 seconds]
<tongcx>
centrx: like python -i
fgo has quit [Remote host closed the connection]
Fyyr13__ has joined #ruby
bricker has quit [Quit: leaving]
evenix has quit [Ping timeout: 265 seconds]
<centrx>
tongcx, Yeah I don't know, maybe pry can do it
<centrx>
tongcx, pry is an alternative to irb
NicholasFlamel has joined #ruby
dkamioka has joined #ruby
emergion has quit [Ping timeout: 260 seconds]
Fyyr13___ has joined #ruby
Celm has joined #ruby
bbloom has joined #ruby
meatherly has quit [Ping timeout: 252 seconds]
skkeeper has quit [Ping timeout: 246 seconds]
Fyyr13_ has quit [Ping timeout: 264 seconds]
Fyyr13___ has quit [Read error: Connection reset by peer]
<tongcx>
centrx: i c, thanks a lot
Fyyr13_ has joined #ruby
evenix has joined #ruby
Fyyr13__ has quit [Ping timeout: 264 seconds]
pfg has joined #ruby
<centrx>
tongcx, If you do: echo "a = 5" | irb
morenoh149 has joined #ruby
<ryanf>
pry does have that feature for some reason
<centrx>
tongcx, It will run it, but irb exits, so that might also be another starting point
NicholasFlamel has quit [Ping timeout: 240 seconds]
<ryanf>
tbh I kind of feel like it's bloat, but it's there
Fyyr13__ has joined #ruby
cjsarette has quit [Ping timeout: 245 seconds]
<ryanf>
oh nvm, it's not released yet. but you can run "pry file.rb" to go through the script line by line and dump you into a console if there's an error
etqqkoiflwhb has joined #ruby
<ryanf>
and if you make the last line of the file "binding.pry", it will do the rest of what you wanted
Fyyr13___ has joined #ruby
m104 has joined #ruby
cjsarette has joined #ruby
skkeeper has joined #ruby
Fyyr13_ has quit [Ping timeout: 264 seconds]
duggiefresh has joined #ruby
etqqkoiflwhb has quit [Remote host closed the connection]
Fyyr13__ has quit [Ping timeout: 264 seconds]
etqqkoiflwhb has joined #ruby
craigp has joined #ruby
invinceable has joined #ruby
werdnativ has quit [Quit: werdnativ]
Fyyr13___ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
Fyyr13__ has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
hello has quit [Quit: Leaving]
duggiefresh has quit [Remote host closed the connection]
koderok has joined #ruby
Fyyr13__ has quit [Read error: Connection reset by peer]
endash has quit [Read error: No route to host]
duggiefresh has joined #ruby
Fyyr13_ has joined #ruby
jjbohn has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
1JTAANIGS has quit []
Fyyr13_ has joined #ruby
endash has joined #ruby
etqqkoiflwhb has left #ruby [#ruby]
toastynerd has quit [Remote host closed the connection]
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
duggiefresh has quit [Ping timeout: 240 seconds]
jjbohn has quit [Ping timeout: 240 seconds]
browndawg has joined #ruby
dapz has joined #ruby
etqqkoiflwhb has joined #ruby
browndawg has quit [Client Quit]
Fyyr13_ has quit [Read error: Connection reset by peer]
<markalanevans>
popl: so it seems that what is happen, is that in that drop while block
<markalanevans>
In the case where the value != 8
<markalanevans>
i have a return false
phansch has quit [Quit: WeeChat 0.4.2]
CorySimmons has quit [Ping timeout: 265 seconds]
<markalanevans>
but what is happening, is that the function that contains this drop_while block is actually returning, rather than the block just ending
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
<markalanevans>
Does that make sense
dkamioka_ has quit [Ping timeout: 264 seconds]
zachallett has joined #ruby
<n88_>
craigp: so if i serialize the JSON to mysql
<n88_>
when i'm pulling it back out will it still preserve the key value relationship
<n88_>
or will it just be a text blob
<centrx>
markalanevans, Yes, you need to "next" in a block
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
<centrx>
n88_, It will be a JSON string that needs to be parsed with JSON.parse
<n88_>
ok, easy enough
<centrx>
n88_, What ORM are you using?
<n88_>
eventually it's going to be active record
burgess has joined #ruby
zachallett has quit [Remote host closed the connection]
<n88_>
right now i'm just writing a simple web/css scraper
twiceaday has quit [Ping timeout: 264 seconds]
<n88_>
sending it into the db as its scraped
francisfish has quit [Ping timeout: 240 seconds]
<n88_>
and then repackaging it into a rails app
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
twiceaday has joined #ruby
<centrx>
n88_, I seems like it would be a lot easier to use an ORM now, instead of re-writing all the database connectivity later?
<Hanmac>
markalanevans: arw you sure you want drop_while and not take_while ?
<markalanevans>
Hanmac: yes.
<n88_>
I will be scraping/inserting millions and millions of lines
<markalanevans>
I want to keep removing elements until i get to the first case where the condition is met
<mostlybadfly>
i did print ingredients just to make sure my input was inserted into the array
<centrx>
mostlybadfly, I wouldn't change it except some minor style things
<centrx>
mostlybadfly, Remove the parentheses around the if-statement in the break if
<centrx>
mostlybadfly, And move the puts inside the loop to the bottom so it doesn't look like it is related to the append array when it is actually asking for the _next_ input
Fyyr13__ has quit [Read error: Connection reset by peer]
timonv has joined #ruby
<centrx>
mostlybadfly, Mix single and double quotes so you don't have to escape the quotes with \"done\"
Fyyr13_ has joined #ruby
<centrx>
mostlybadfly, Actually here's an idea
lyubent has joined #ruby
echevemaster has quit [Remote host closed the connection]
Fyyr13_ has quit [Read error: Connection reset by peer]
dkamioka has joined #ruby
<mostlybadfly>
thanks for those so far, i couldn't quite remember the mixing the quotes idea
Fyyr13_ has joined #ruby
yubrew has quit [Ping timeout: 265 seconds]
<mostlybadfly>
this is my first little bit of code i'm writing myself for a project after taking a few tutorials :D so i'm excited and hoping i'm doing things kinda right
arietis has joined #ruby
<centrx>
mostlybadfly, Yes, it looks good
quatron has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
Wolland has joined #ruby
FDj has quit [Ping timeout: 245 seconds]
<centrx>
mostlybadfly, There is another way you could do it, but it's hard to say that it's better than what you have
Fyyr13_ has quit [Read error: Connection reset by peer]
<mostlybadfly>
thanks centrx i'm going to look at both, this will come in useful either way , the more ways I know to do something the better
<mostlybadfly>
:)
nateberkopec has joined #ruby
Fyyr13_ has joined #ruby
tvw has joined #ruby
<centrx>
mostlybadfly, begin...end while is what's called a "do-while loop"
morenoh149 has quit [Ping timeout: 264 seconds]
etqqkoiflwhb_ has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
<mostlybadfly>
ah ok, that is interesting. i haven't come across that specifically yet but it immediately makes sense
Fyyr13_ has joined #ruby
etqqkoiflwhb has quit [Read error: Connection reset by peer]
Hanmac has quit [Ping timeout: 252 seconds]
skaflem has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
mlpinit has quit [Ping timeout: 264 seconds]
<centrx>
I must be going now
<centrx>
Good luck
nateberkopec has quit [Ping timeout: 240 seconds]
<centrx>
Fare thee well
toastynerd has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
rs0 has joined #ruby
Fyyr13_ has joined #ruby
<rs0>
I don't understand the behavior of http://pastebin.com/k1cGxkzz (closing a pipe across process vs across Ruby threads). Can someone explain what the story is here?
centrx has quit [Quit: All this computer hacking is making me thirsty]
dkamioka has quit [Remote host closed the connection]
<etqqkoiflwhb_>
mostlybadfly: I think, you should separate reading from processing part
Fyyr13__ has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
<mostlybadfly>
etqqkoiflwhb_: what do you mean?
<etqqkoiflwhb_>
give me a minute, I'm jolting down it down in a different way
Fyyr13__ has quit [Read error: Connection reset by peer]
vlad_starkov has quit [Remote host closed the connection]
invinceable has quit [Ping timeout: 244 seconds]
<mostlybadfly>
thanks
Fyyr13_ has joined #ruby
dkamioka_ has joined #ruby
Hanmac has joined #ruby
CharlieG has joined #ruby
<CharlieG>
Hello
nadirvardar has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
<CharlieG>
Can someone help me with a beginner ruby problem?
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
bcavileer_ has quit [Ping timeout: 244 seconds]
ceej has quit [Ping timeout: 244 seconds]
davorb has quit [Ping timeout: 245 seconds]
charles81 has quit [Ping timeout: 245 seconds]
supershabam has quit [Ping timeout: 240 seconds]
burgess has quit [Quit: ^zzz]
adambeynon has quit [Ping timeout: 265 seconds]
antonishen has quit [Ping timeout: 240 seconds]
vcoinminer_ has quit [Ping timeout: 245 seconds]
zzak has quit [Ping timeout: 245 seconds]
pusewicz__ has quit [Ping timeout: 240 seconds]
BaconOverflow has quit [Ping timeout: 265 seconds]
gyre007__ has quit [Ping timeout: 265 seconds]
alol has quit [Ping timeout: 240 seconds]
bedouin_ has quit [Ping timeout: 244 seconds]
Tranquility has quit [Ping timeout: 240 seconds]
mattmcclure has quit [Ping timeout: 245 seconds]
rickenharp_ has quit [Ping timeout: 245 seconds]
Fyyr13__ has joined #ruby
schaary has quit [Ping timeout: 240 seconds]
drjblouse__ has quit [Ping timeout: 265 seconds]
mourest has joined #ruby
timonv has quit [Remote host closed the connection]
<etqqkoiflwhb_>
mostlybadfly: I think Ennumerable module expects you to define each, which yields a value each time its called, you can google, if you can do it, you can use all Ennumerable methods on ReadIngredient
CorySimmons has quit [Ping timeout: 240 seconds]
Fyyr13__ has quit [Read error: Connection reset by peer]
<etqqkoiflwhb_>
so ReadIngredient.each_with_object([]) { .. }
Fyyr13__ has joined #ruby
Fyyr13_ has quit [Ping timeout: 264 seconds]
lyubent has quit [Quit: Leaving.]
yasushi has joined #ruby
FDj has joined #ruby
Fyyr13_ has joined #ruby
dkamioka_ has quit [Remote host closed the connection]
User458764 has joined #ruby
<markalanevans>
Hey guys, my api, that my app uses relies on multiple 3rd party api's.
<markalanevans>
Requests need to come in very quickly.
<mostlybadfly>
thanks etqqkoiflwhb_ , i seem to be getting an error on the last line but i'm not sure why
Fyyr13___ has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
senayar has quit [Remote host closed the connection]
<markalanevans>
So i want to learn about strategies for having methods that call web services, but if those services take to long to response(ms) my main method will handle that gracefully and still return
senayar has joined #ruby
<markalanevans>
These are not back ground process.
<markalanevans>
What strategies / words should I be googling for?
<etqqkoiflwhb_>
mostlybadfly: I didn;t run it, i just wanted to show the separation of concerns, of looping, and executing you logic over each input, you should be able to figure out the syntax errors
Fyyr13___ has quit [Read error: Connection reset by peer]
Fyyr13__ has quit [Ping timeout: 264 seconds]
marcdel_ has quit []
koderok_ has joined #ruby
<mostlybadfly>
ok thanks
Fyyr13_ has joined #ruby
visof has joined #ruby
<visof>
hello
evenix_ has quit []
yasushi has quit [Ping timeout: 265 seconds]
closures999 has joined #ruby
<mostlybadfly>
gotta go to bed, goodnight everyone
<visof>
i have list of 7000 elements which try to use threads for each element but i got `initialize': can't create Thread (11) (ThreadError) , when i decrease the size to 100 it works, it's failling even with 300 elements
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
<certainty>
visof: we need more information, like code
<markalanevans>
once they all return or fail, then i could return to my customer
Fyyr13_ has quit [Read error: Connection reset by peer]
<markalanevans>
and if some don't return, i just need to note that
Fyyr13_ has joined #ruby
<etqqkoiflwhb_>
popl: nice gem
timonv has joined #ruby
dexter_ has joined #ruby
Fyyr13__ has quit [Ping timeout: 264 seconds]
<markalanevans>
hmmm.
<certainty>
visof: works here as i'd expect it. That's a strange error. You might want to add threads.map(&:join) at the end, but that doesn't explain the error
<markalanevans>
both sound interesting
monkegjinni has joined #ruby
<markalanevans>
popl: have you used either?
<popl>
no
<popl>
futures/promises all generally work similarly, though
<popl>
I've used them in Java and Perl
Fyyr13__ has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
<markalanevans>
Ok. Any thing else come to mind before i start diving in?
<Nilium>
Set a potted plant on fire to keep you warm.
Fyyr13__ has quit [Read error: Connection reset by peer]
<popl>
Don't trust whitey.
<certainty>
visof: which ruby is that?
zachallett has quit [Ping timeout: 265 seconds]
Fyyr13_ has joined #ruby
<visof>
certainty: ruby 1.9.3
<etqqkoiflwhb_>
visof: would having so many threads help? unless each thread does some IO
<certainty>
visof: mri i suspect?
<certainty>
etqqkoiflwhb_: i think that's just a simplified example
banister has joined #ruby
yubrew has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
<visof>
certainty: yeah
Fyyr13_ has joined #ruby
<Nilium>
Go is a pretty fun programming language.
<visof>
isn't ruby threads very bad?
<visof>
Nilium: i agree
banister has quit [Client Quit]
yfeldblu_ has quit [Ping timeout: 264 seconds]
<etqqkoiflwhb_>
visof: No, they are fun, but I personally feel, for ruby, Threading is too low level
<etqqkoiflwhb_>
It should be message passing for concurrent code
yfeldblum has joined #ruby
<etqqkoiflwhb_>
instead of threads or a higher level abstraction like message passing
sparrovv has joined #ruby
koderok has quit [Read error: Connection reset by peer]
<popl>
message passing instead of message passing?
<popl>
huh? :)
Fyyr13__ has joined #ruby
koderok has joined #ruby
<Nilium>
Somewhere a robot's head exploded
<visof>
etqqkoiflwhb_: what do you think about the code i have posted , how can i fix this?
<certainty>
visof: why would it be bad? because they're green or because of the GIL?
<certainty>
anyway, gotta run
<certainty>
me &
<certainty>
erm
oneawayman has joined #ruby
<visof>
certainty: you got limited threads
etqqkoiflwhb_ has quit [Read error: Connection reset by peer]
claymore has joined #ruby
koderok has quit [Client Quit]
Fyyr13__ has quit [Read error: Connection reset by peer]
etqqkoiflwhb_ has joined #ruby
Fyyr13___ has joined #ruby
koderok has joined #ruby
yubrew has quit [Ping timeout: 240 seconds]
Fyyr13_ has quit [Ping timeout: 264 seconds]
Fyyr13___ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
monkegjinni has quit [Remote host closed the connection]
mary5030 has joined #ruby
<etqqkoiflwhb_>
visof: too small a code to comment, depends on what you plan to do, if you have http requests, you can use celluloid for concurrent requests, not sure, haven;t experimented much with threads yet
monkegjinni has joined #ruby
monkegjinni has quit [Read error: No route to host]
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13__ has joined #ruby
timonv has quit [Remote host closed the connection]
Xuerian has quit [Quit: No Ping reply in 180 seconds.]
davedev24 has quit [Remote host closed the connection]
<etqqkoiflwhb_>
just a generic question, what would be a good next language after ruby, asking this with functional programming in mind
Fyyr13__ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
nisstyre_ has quit [Quit: WeeChat 0.4.3]
glosoli has joined #ruby
Fyyr13__ has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
dkamioka has joined #ruby
timonv has joined #ruby
Fyyr13__ has quit [Read error: Connection reset by peer]
mary5030 has quit [Remote host closed the connection]
Fyyr13_ has joined #ruby
deadlock has joined #ruby
nateberkopec has joined #ruby
mlpinit has joined #ruby
postmodern has joined #ruby
<koderok>
etqqkoiflwhb_: You can take a look at Haskell. It's the most popular functional language today IMO & widely called the language of the future mostly bcoz of its parallelism.
dkamioka_ has joined #ruby
dkamioka has quit [Read error: Connection reset by peer]
koderok_ has quit [Remote host closed the connection]
<glosoli>
Clojure is also some functional fun :)
nateberkopec has quit [Read error: No route to host]
nateberkopec has joined #ruby
Fyyr13__ has joined #ruby
timonv has quit [Remote host closed the connection]
Fyyr13__ has quit [Read error: Connection reset by peer]
<certainty>
etqqkoiflwhb_: i'd go with clojure or elixir if you come from ruby. Haskell is certainly a great language, but the learning curve is much steaper if you don't have some understanding of functional programming. If you have however, haskell is a great choice lots of libraries and a cutting edge compiler
<mozzarella>
isn't erlang better at that?
Fyyr13__ has joined #ruby
<mozzarella>
and how can a "language of the future" be 24 years old? lol
quatron has quit [Quit: ChatZilla 0.9.90.1 [Firefox 27.0.1/20140212131424]]
mlpinit has quit [Ping timeout: 265 seconds]
Fyyr13_ has quit [Ping timeout: 264 seconds]
<certainty>
mozzarella: because it took some time to make it fast enough, and we now have a need for languages that work well in concurrent context as cpus wont get signicantly faster.
Fyyr13__ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
dkamioka_ has quit [Ping timeout: 265 seconds]
<mozzarella>
what about erlang?
<visof>
mozzarella: Erlang is more mature on messaging passing and concurrency
nateberkopec has quit [Ping timeout: 240 seconds]
<certainty>
i like clojure because it's a lisp and because it has very well designed abstractions for dealing with multi threaded programs
Slavox is now known as Slavox|AFK
hiyosi has quit [Ping timeout: 240 seconds]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
<certainty>
i love haskell because of its neat ideas and the general robustness of its programs
<etqqkoiflwhb_>
certainity: some of colleagues are picking up elixir, I can learn from them, I'm looking at haskell, but I don't know where to start from, clojure is cool, but has the runtime takes a bit of time to start up
<etqqkoiflwhb_>
not cool for command line tools
jackneill has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
<certainty>
etqqkoiflwhb_: yes that's certainly true the vm has to warm up
<mozzarella>
etqqkoiflwhb_: elixir is close to erlang, no?
Fyyr13_ has joined #ruby
<certainty>
etqqkoiflwhb_: OTOH you have all of java at your disposal
<etqqkoiflwhb_>
certainty: any advice on where to pick haskell from?
<certainty>
mozzarella: yes
<certainty>
etqqkoiflwhb_: yes, real world haskell and learn you a haskell for great good are awesome resources
<mozzarella>
I want to learn elixir and erlang…
<etqqkoiflwhb_>
mozzarella: Its based of the erlang beam vm, pragdave gave a introductory talk at bangalore ruby users group meetup, the videos should be up in a couple of days, you can have a look
burgess has joined #ruby
User458764 has joined #ruby
<certainty>
mozzarella: elixir has erlang interop and targets the erlang vm so knowing both will give you most
<popl>
erlang :)
tkuchiki has quit [Remote host closed the connection]
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
<etqqkoiflwhb_>
certainly: thanks, what should my the next steps, after pickup up haskell from those books
<etqqkoiflwhb_>
be the*
<certainty>
etqqkoiflwhb_: build real stuff with it and join #haskell
<certainty>
etqqkoiflwhb_: at some point you will likely want to learn some category theory
Fyyr13_ has joined #ruby
rjk808 has joined #ruby
<mozzarella>
should I learn erlang and elixir, or haskell, or some lisp?
<visof>
certainty: i guess no, dealing with types and monads don't need category theory , it's not for mathematicians only
<certainty>
mozzarella: depends on your need. I can't predict the future but I suspect that clojure has a good future with quite some industry around it. Elixir might be hot too in the future. Haskell has always been badass, but little companies leverage it yet
<etqqkoiflwhb_>
certainty: any moderately complex haskell projects on github where I can learn from reading the source, like xmonad, unfortunately I'm not using it these days, so if there's anything interesting to explore, which works on osx
<certainty>
visof: yes you don't need it from a programmer's point of view but it certainly helps to understand the principles. At least it made things clearer to me
Fyyr13__ has joined #ruby
kendzior has joined #ruby
<certainty>
etqqkoiflwhb_: i like husk-scheme, but there are certainly others. The problem with real world haskell programs that are of a decent size, is that they tend to use advanced abstractions that are not easy to follow for a beginner
Fyyr13__ has quit [Read error: Connection reset by peer]
browndawg has quit [Ping timeout: 240 seconds]
glosoli has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Fyyr13__ has joined #ruby
spider-mario has joined #ruby
<etqqkoiflwhb_>
certainty: would one be able to wade through them after LYAH, real world haskell?
Fyyr13_ has quit [Ping timeout: 264 seconds]
<certainty>
etqqkoiflwhb_: yes, with some reading as you go by, to understand the libraries
Fyyr13__ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
ktosiek has joined #ruby
kitak has quit [Remote host closed the connection]
monkegjinni has joined #ruby
<certainty>
you should be fluent with monads and monadtransformers at the least
<etqqkoiflwhb_>
certainty: one last question, is tdd in haskell as beneficial as it is in ruby?
<certainty>
etqqkoiflwhb_: in haskell we don't do classic unit testing most of the time. Instead we check invariants of functions with quickcheck
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13__ has joined #ruby
<etqqkoiflwhb_>
certainty: thanks for your inputs, they are of massive help
<certainty>
etqqkoiflwhb_: in haskell we have several phases. First we make sure that the program typechecks and once it does we test function properties
<etqqkoiflwhb_>
oh
<certainty>
at least that's how i do stuff and i'm certainly a beginner haskeller
railly has joined #ruby
railly has quit [Max SendQ exceeded]
railly has joined #ruby
Fyyr13_ has joined #ruby
railly has quit [Max SendQ exceeded]
Fyyr13__ has quit [Read error: Connection reset by peer]
CorySimmons has joined #ruby
<certainty>
etqqkoiflwhb_: that's an interleaved process. Most haskell functions are tiny and "obviously correct" at least if we follow best practices. Those can be tested interactively one by one. Also as most of them will be pure, it's very easy to test them in the repl
etqqkoiflwhb_ has quit [Read error: Connection reset by peer]
railly has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
Wolland has quit [Remote host closed the connection]
User458764 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
railly has quit [Max SendQ exceeded]
Fyyr13_ has joined #ruby
railly has joined #ruby
fgo has quit [Remote host closed the connection]
railly has quit [Max SendQ exceeded]
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
francisfish has joined #ruby
railly has joined #ruby
railly has quit [Max SendQ exceeded]
peterhellberg has joined #ruby
CorySimmons has quit [Ping timeout: 240 seconds]
monkegjinni has quit [Remote host closed the connection]
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
lolmaus has quit [Read error: Operation timed out]
railly has joined #ruby
monkegjinni has joined #ruby
railly has quit [Max SendQ exceeded]
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
Lewix has quit [Remote host closed the connection]
<chridal>
Tried posting something in #rubyonrails,but it seems no one is around. Anyone mind me asking a rails/rspec issue?
francisfish has quit [Ping timeout: 240 seconds]
Packardnode has quit [Remote host closed the connection]
lolmaus has joined #ruby
<bnagy>
people that care about rails will also be over there
railly has joined #ruby
<bnagy>
this is a slow time
<chridal>
ah, ok
railly has quit [Max SendQ exceeded]
<chridal>
I'll hang around then
Fyyr13__ has joined #ruby
<certainty>
chridal: just ask
<chridal>
So, I'm trying to test my controller with rspec, but I can't seem to get a hold of the instance variable inside one of the actions.
<chridal>
hm, so what exactly should I test for in the controller test?
railly has joined #ruby
railly has quit [Max SendQ exceeded]
Fyyr13__ has joined #ruby
<certainty>
chridal: all of the controller concerns. You know what the controller's job is?
<chridal>
would it make more sense to write controller tests as API tests basically? Check for JSON return and status codes?
DouweM has quit [Ping timeout: 240 seconds]
railly has joined #ruby
railly has quit [Max SendQ exceeded]
<chridal>
I was thinking of maybe separating those into a set of 'api tests'
Vovko has joined #ruby
<chridal>
well, my best guess is that the controller is responsible for co-ordinating between the client and the data
Fyyr13__ has quit [Read error: Connection reset by peer]
<certainty>
chridal: my guess is that you didn't create a User with that name before the test runs? (You shouldn't be, instead you should stub the call that finds the user by name)
railly has joined #ruby
Fyyr13__ has joined #ruby
railly has quit [Max SendQ exceeded]
<chridal>
aha! yea, I didn't. So that's why it's nil.
railly has joined #ruby
railly has quit [Max SendQ exceeded]
tesuji has quit [Ping timeout: 265 seconds]
Fyyr13_ has quit [Ping timeout: 264 seconds]
rjk808 has quit []
<certainty>
chridal: almost. It's job is to extract parameters and pass them to the apropriate model(s), then take the results back and hand it over to the correct view(s), practically speaking
railly has joined #ruby
yubrew has joined #ruby
newbie1r has joined #ruby
railly has quit [Max SendQ exceeded]
railly has joined #ruby
james_d_h has quit [Ping timeout: 240 seconds]
railly has quit [Max SendQ exceeded]
Fyyr13_ has joined #ruby
newbie1r|2 has joined #ruby
newbie1r has quit [Client Quit]
blackmesa has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13___ has joined #ruby
railly has joined #ruby
railly has quit [Max SendQ exceeded]
<chridal>
certainty: So I shouldn't be testing whether vars get set or not? But just what is returned?
Fyyr13__ has quit [Ping timeout: 264 seconds]
Fyyr13___ has quit [Read error: Connection reset by peer]
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13__ has joined #ruby
newbie1r|2 has quit [Ping timeout: 240 seconds]
<certainty>
chridal: testing assins is fine since that's the interface to the view
<certainty>
you shouln't be querying the database
railly has joined #ruby
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
railly has quit [Max SendQ exceeded]
<certainty>
instead you verify that the correct method on the model is invoked with the correct arguments
YamakasY has joined #ruby
Fyyr13_ has joined #ruby
<certainty>
chridal: you want something like User.should_receive(:find_by_name).with("theuser").and_return
nari has joined #ruby
newbie1r has joined #ruby
m8 has joined #ruby
railly has joined #ruby
<certainty>
gotta run now
railly has quit [Max SendQ exceeded]
<chridal>
aha! Well thanks a lot for your help.
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
Fyyr13__ has quit [Ping timeout: 264 seconds]
<certainty>
chridal: the real story is that you shouldn't stub that but a method on your own class instead that uses activerecord. The rule is "only stub what you own", because you need to be able to change
Fyyr13__ has joined #ruby
<chridal>
certainty: Do you know of any resources that I should be reading to learn this stuff?
shredding has joined #ruby
Fyyr13___ has joined #ruby
Fyyr13_ has quit [Ping timeout: 264 seconds]
Fyyr13___ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
klaut_ has joined #ruby
mengu has joined #ruby
Fyyr13__ has quit [Ping timeout: 264 seconds]
jtza8 has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13__ has joined #ruby
Fyyr13_ has joined #ruby
Fyyr13__ has quit [Read error: Connection reset by peer]
ScalaClient has quit [Ping timeout: 244 seconds]
dkamioka has joined #ruby
nateberkopec has joined #ruby
oneawayman has quit [Read error: Connection reset by peer]
Fyyr13_ has quit [Read error: Connection reset by peer]
oneawayman has joined #ruby
compleatang has quit [Remote host closed the connection]
mlpinit has joined #ruby
Fyyr13_ has joined #ruby
compleatang has joined #ruby
Fyyr13__ has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
<Robbo_>
anyone got some time to give some basic advice? (im not asking to ask, typing out question now)
Fyyr13__ has quit [Read error: Connection reset by peer]
<Robbo_>
My question is what is the best way to extend this stuff? It is just a gem with an entry point for middleman extensions
mlpinit has quit [Ping timeout: 240 seconds]
ankushio has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
<ankushio>
In ruby, what does "a:" mean. I know that ":a" is a symbol, but what's "a:" ?
Fyyr13_ has joined #ruby
<Robbo_>
Should I require that file, extend it, use parent (or whatever it is in ruby) to get the data there and add what I want and then have middleman config point to the new gem?
mojjojo has quit [Client Quit]
<Robbo_>
This is how I would do it in other languages however is there any tricks I can do in ruby to make it a little simpler?
kate_r has quit [Remote host closed the connection]
railly has joined #ruby
<Robbo_>
This question is sounding stupid and rubber ducky
railly has quit [Max SendQ exceeded]
eka has joined #ruby
Fyyr13__ has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
railly has joined #ruby
railly has quit [Max SendQ exceeded]
Fyyr13__ has quit [Read error: Connection reset by peer]
dkamioka has quit [Ping timeout: 240 seconds]
railly has joined #ruby
railly has quit [Max SendQ exceeded]
Fyyr13_ has joined #ruby
mary5030 has joined #ruby
SHyx0rmZ has joined #ruby
WormDrink has quit [Ping timeout: 252 seconds]
railly has joined #ruby
railly has quit [Max SendQ exceeded]
jhass|off is now known as jhass
railly has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
dexter_ has quit [Ping timeout: 240 seconds]
railly has quit [Max SendQ exceeded]
Fyyr13_ has joined #ruby
railly has joined #ruby
Fyyr13_ has quit [Read error: Connection reset by peer]
railly has quit [Max SendQ exceeded]
<ankushio>
RubyPanther: In ruby, what does "a:" mean. I know that ":a" is a symbol, but what's "a:" ?
Fyyr13_ has joined #ruby
workmad3 has joined #ruby
burgess has quit [Quit: ^zzz]
<apeiros>
ankushio: depends o the context
railly has joined #ruby
<apeiros>
in {a: 1} it's a symbol too
<Hanmac>
ankushio: named agrument or special snytax in Hash
shabgard has joined #ruby
shabgard has joined #ruby
railly has quit [Max SendQ exceeded]
<apeiros>
in def foo(a: 1) it's a named argument, and as such a local variable.
mary5030 has quit [Ping timeout: 265 seconds]
<ankushio>
I saw this line : "protect_from_forgery with: :exception"
<apeiros>
yes, there it's a symbol
dexter_ has joined #ruby
pusewicz__ has joined #ruby
<apeiros>
`protect_from_forgery with: :exception` is a short form of `protect_from_forgery({with: :exception})`
<ankushio>
ahh
<apeiros>
and `{with: :exception}` is as said equivalent to `{:with => :exception}`
<ankushio>
Thanks apeiros and Hanmac
<apeiros>
yw
hiyosi has joined #ruby
_2_tiapatrick2 has joined #ruby
<Hanmac>
apeiros: about the protect_from_forgery, depends if the function wants key arguments or not ...
<csmrfx>
then again, one could just get a shell account
withnale has joined #ruby
Aquilo has left #ruby [#ruby]
<Morrolan>
Though then you'd have to use a console-based IRC client. *shudders*
<csmrfx>
<3 irssi
etqqkoiflwhb_ has joined #ruby
davorb has joined #ruby
<Morrolan>
's fine, I don't judge. Just don't make me use it. :P
<csmrfx>
the only way to ride
<withnale>
Hello. Can anyone tell me if it's possible to work with the underlying OptionParser object when usiing GLI?
<csmrfx>
ssh, bash, screen, irssi, irb, ri, all in the same terminal
quatron has joined #ruby
BaconOverflow has joined #ruby
<csmrfx>
withnale: sorry for intercepting, but why not just ARGV
timonv has joined #ruby
tgkokk has joined #ruby
koell has quit [Read error: Connection reset by peer]
<csmrfx>
withnale: anyway, from the look of GLI, it is 100% possible to use OP
<peterhellberg>
@csmrfx Yeah, irssi is a really nice command line client.
michael_lee has joined #ruby
<withnale>
csmrfx: I've written a command suite using GLI and I'm getting frustrated at some points where I don't have the same level of control of the option parsing.
<peterhellberg>
withnale: From the README: "without restricting you in any way from the power of OptionParser."
<csmrfx>
withnale: but, I do not know from experience how GLI and OP work together
peret has quit [Remote host closed the connection]
mattmcclure has joined #ruby
mojjojo has joined #ruby
timonv has quit [Ping timeout: 240 seconds]
supershabam has joined #ruby
mourest has quit [Remote host closed the connection]
alexju has quit [Remote host closed the connection]
banister has joined #ruby
mojjojo has quit [Client Quit]
nolic has joined #ruby
mojjojo has joined #ruby
nomenkun has quit [Remote host closed the connection]
nateberkopec has joined #ruby
WormDr1nk has quit [Ping timeout: 240 seconds]
WormDrink has joined #ruby
mlpinit has joined #ruby
Thanatermesis has joined #ruby
Vovko has quit [Remote host closed the connection]
<apeiros>
is GLI short for Gommand Line Interface? :D
sparrovv has quit [Remote host closed the connection]
NovapaX has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
senayar has joined #ruby
spider-mario has joined #ruby
senayar has quit [Read error: No route to host]
senayar has joined #ruby
dexter_ has joined #ruby
Squarepy has joined #ruby
ktosiek_ is now known as ktosiek
glosoli has joined #ruby
browndawg has quit [Ping timeout: 240 seconds]
Hanmac1 has joined #ruby
mojjojo has quit [Quit: mojjojo]
bthesorceror has quit [Remote host closed the connection]
<Dwarf>
How would I tackle DEPRECATION WARNING: Relation#first with finder options is deprecated. Please build a scope and then call #first on it instead.
Hanmac has quit [Ping timeout: 244 seconds]
<Dwarf>
Google isn't really helpful oddly
Xeago has quit [Remote host closed the connection]
dayepa has joined #ruby
senayar has quit [Ping timeout: 244 seconds]
peterhellberg has quit [Remote host closed the connection]
Hanmac has joined #ruby
<jhass>
Dwarf: one would follow what the message says (which is quite clear) and if that doesn't help ask rails questions in #RubyOnRails ;)
<Dwarf>
You can use activerecord without rails...
shredding has quit [Quit: shredding]
<Dwarf>
And if I knew how to build a scope I wouldn't be here
<jhass>
still all the AR expertise is over there
<Dwarf>
But they scare me
<jhass>
whatever.where(stuff).first instead of whatever.first(stuff)
klaut_ has joined #ruby
WormDrink has quit [Ping timeout: 264 seconds]
<Dwarf>
So..
sailias has quit [Ping timeout: 240 seconds]
<Dwarf>
I'm going to google some more stuff I suppose
<Dwarf>
Thanks!
Hanmac1 has quit [Ping timeout: 244 seconds]
lyubent has joined #ruby
dmyers has quit [Quit: Connection closed for inactivity]
<Dwarf>
Would
<Dwarf>
def self.first(stuff)
<Dwarf>
where(stuff).first
<Dwarf>
end
<Dwarf>
Work?
tgkokk has joined #ruby
<jhass>
it would but be extremely ugly
leonidlm has joined #ruby
shevy has quit [Ping timeout: 244 seconds]
sigurding has joined #ruby
nateberkopec has joined #ruby
<jhass>
just port to the new api
klaut_ has quit [Ping timeout: 240 seconds]
<Dwarf>
Aye I suppose that's better
<jhass>
I mean you could probably fix it with sed
<jhass>
sed -i 's/first\((.+)\)/where(\1).first/ or something like that
<Dwarf>
Yea, gotta love regex
<Dwarf>
Oh joy
<Dwarf>
could not obtain a database connection within 5.000 seconds (waited 5.001 seconds) (ActiveRecord::ConnectionTimeoutError)
<Dwarf>
That's weird tho cause it works with selecting but updating does that
mlpinit has joined #ruby
<Dwarf>
Oh well
<jhass>
sounds like a lock
mengu has quit []
<Dwarf>
There shouldn't be any locks
<jhass>
your dbms should lock
nateberkopec has quit [Ping timeout: 240 seconds]
shevy has joined #ruby
bogeyd6 has quit [Ping timeout: 240 seconds]
zorak_ has joined #ruby
dayepa has quit [Quit: dayepa]
dkamioka has joined #ruby
weie has quit [Quit: Leaving...]
Vovko has joined #ruby
akitada has joined #ruby
mlpinit has quit [Ping timeout: 240 seconds]
klaut_ has joined #ruby
WormDrink has joined #ruby
mourest has joined #ruby
Fyyr13_ has quit [Remote host closed the connection]
<Dwarf>
Thanks a bunch, managed to solve it!
Fyyr13_ has joined #ruby
weie has joined #ruby
dkamioka has quit [Ping timeout: 240 seconds]
Vovko has quit [Ping timeout: 265 seconds]
arietis has quit [Quit: Computer has gone to sleep.]
Fyyr13__ has joined #ruby
Fyyr13__ has quit [Remote host closed the connection]
Fyyr13_ has quit [Read error: Connection reset by peer]
Fyyr13_ has joined #ruby
jtza8 has quit [Ping timeout: 240 seconds]
shredding has joined #ruby
Fyyr13__ has joined #ruby
yubrew has joined #ruby
<sigurding>
anyone may tell me, how I am able to convert a nested object into a Hash, without specifying each property manually?
Fyyr13_ has quit [Ping timeout: 252 seconds]
peterhellberg has joined #ruby
<jhass>
sigurding: nested object?
sepp2k has joined #ruby
<Squarepy>
^^
<sigurding>
what's funny about it?
<sigurding>
Classes containing others classes
<sigurding>
Squarepy: you should not laugh about others, only cause you don't know/get the concept
<sigurding>
show a little more respect
<jhass>
nested object is very vague
<jhass>
best is to implement #to_h on each
<Squarepy>
sigurding, that was not humor, just pointing to a relevant question, sry for confusion
timonv has joined #ruby
shevy has quit [Ping timeout: 264 seconds]
<sigurding>
jhass: that's what I have seen. Thought of doing it recursively
maximski has joined #ruby
yubrew has quit [Ping timeout: 244 seconds]
<sigurding>
so something like to_h and to_dh (deep hash)
<jhass>
you still didn't tell anything about your objects though. Is there a way to enumerate all fields? do you even want to include all fields? etc.
<jhass>
have the nested objects the same type as the parents?
<jhass>
maybe look at the composite pattern
mojjojo has joined #ruby
tils has joined #ruby
<sigurding>
jhass: yes, I want to post them via json, so I want all fields
<Packardnode>
hey. i have debian 7 32bit running and wanted to run a .rb file. but when i do sudo gem install cinch i get " Unable to convert U+2026 from UTF-8 to US-ASCII for lib/.... "
<Packardnode>
how do i fix this ?
<soahccc>
Packardnode: which ruby version do you have?
senayar has quit [Remote host closed the connection]
dkamioka has quit [Ping timeout: 244 seconds]
nfk has quit [Quit: yawn]
<newbie1r|2>
hello people. I'm an absolute beginner to programming and interested in making GUI linux apps, so looking for an easy language that is also fast. I like the syntax of ruby, but heard it's slow so I looked and people online say PyPy and stuff is fast. is there any ruby-based language like that that's good?
<newbie1r|2>
and that has a good ide suitable for beginners
yubrew has quit [Ping timeout: 240 seconds]
nomenkun has quit [Remote host closed the connection]
timonv has quit [Remote host closed the connection]
henry1 has quit [Quit: WeeChat 0.4.3]
timonv has joined #ruby
nomenkun_ has joined #ruby
senayar has joined #ruby
poguez has joined #ruby
thiagomds has joined #ruby
tkuchiki has joined #ruby
dexter_ has quit [Ping timeout: 240 seconds]
tvw has quit []
<thiagomds>
Hello my name is Thiago. I'm from Brazil, Rio de Janeiro
<thiagomds>
I have one question about of Ruby
<thiagomds>
for example.
<thiagomds>
can i make one system ERP to using ruby?
<thiagomds>
is secure create one system ERP to using ruby?
thiagomds has left #ruby ["WeeChat 0.4.3"]
nfk has joined #ruby
jamto11 has joined #ruby
CorySimmons has joined #ruby
cover has joined #ruby
Umschwung has quit [Ping timeout: 240 seconds]
<shevy>
what is ERP
<DouweM>
Google says Enterprise Resource Planning
<DouweM>
But that doesn't help me a lot
timonv has quit [Remote host closed the connection]
<certainty>
newbie1r|2: dunno about the IDE, i don't use one
sailias has joined #ruby
S0da has quit [Remote host closed the connection]
claymore has joined #ruby
<shevy>
newbie1r|2 either you want speed, then you go towards the C-family, or you want ease of useness, then you use ruby or python. both are rather equivalent; ruby-gnome works, but you should not underestimate the amount of time you have to spend to learn
<certainty>
any language
lyubent has joined #ruby
estebanrules|awa has quit [Quit: Be back soon...]
lxsameer has quit [Quit: Leaving]
<Packardnode>
soahccc ; how can i test that ?
Emmanuel_Chanel has quit [Ping timeout: 240 seconds]
<Packardnode>
or find that*
aryaching has joined #ruby
dexter_ has joined #ruby
sailias has quit [Ping timeout: 240 seconds]
NicholasFlamel has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
phansch has joined #ruby
Thanatermesis has quit [Quit: ɯlɐɔ uı ʞɹoʍ oʇ ƃuıoƃ]
mojjojo has quit [Quit: mojjojo]
yasushi has quit [Remote host closed the connection]
<newbie1r|2>
thanks for the info
Emmanuel_Chanel has joined #ruby
lolmaus has quit [Quit: No Ping reply in 180 seconds.]
<tanathos>
shevy, the secret is I am not coding, I'm a sys admin :d
<DouweM>
shevy: how so? what does your connection have to do with coding
codeitagile has joined #ruby
<certainty>
tanathos: flaky connection?
<tanathos>
certainty, not sure, it's a fact, same machine same server with another connection works perfectly
CharlieG has quit [Ping timeout: 240 seconds]
<shevy>
DouweM dunno, I don't really sit before my computer when I can't access the www
<DouweM>
shevy: you never sit down just to code/work?
crystal77 has joined #ruby
twiceaday has quit [Ping timeout: 240 seconds]
no0code has quit [Remote host closed the connection]
peterhellberg has quit [Remote host closed the connection]
peterhellberg has joined #ruby
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Gues_____ has joined #ruby
shevy has quit [Ping timeout: 265 seconds]
Gues_____ is now known as CorpusCallosum
nomenkun has quit [Remote host closed the connection]
shevy has joined #ruby
DrShoggoth has joined #ruby
eka has quit [Quit: My computer has gone to sleep. ZZZzzz…]
<certainty>
tanathos: strange
einarj has joined #ruby
<certainty>
op around to ban away_?
banister has joined #ruby
eka has joined #ruby
hello has joined #ruby
<tanathos>
certainty, I just found come cns=0 option that seems to do the trick
hello is now known as Xuis_
<certainty>
DouweM: he doesn't know how, without the www :p
niklasb has joined #ruby
<certainty>
tanathos: never heard of that. what does it do?
einarj has quit [Read error: Operation timed out]
nomenkun has joined #ruby
CorySimmons has joined #ruby
<tanathos>
seems like no idle
<tanathos>
or similar
<tanathos>
I actually need to change ISP
LadyRainicorn has joined #ruby
IceDragon has joined #ruby
glosoli has joined #ruby
francisfish has joined #ruby
Mongey has quit [Quit: Mongey]
Hanmac1 has joined #ruby
jph98 has joined #ruby
Fyyr13__ has quit [Remote host closed the connection]
Hanmac has quit [Ping timeout: 240 seconds]
Squarepy has quit [Quit: Leaving]
leonidlm has quit [Ping timeout: 240 seconds]
CorySimmons has quit [Ping timeout: 240 seconds]
closures999 has quit [Remote host closed the connection]
godd2 has joined #ruby
Hanmac has joined #ruby
<shevy>
DouweM hmm not really, I only code when I have specific needs, like yesterday when I extended class Extracter which extracts archives for me; I needed that mostly just so I can download remote packages, and re-package them locally. Without internet connection, this is almost totally useless though
<shevy>
I just got reconnected :\
minasmazar has joined #ruby
<shevy>
<DouweM> shevy: you never sit down just to code/work?
<DouweM>
right, makes sense if it's just hobby coding and writing scripts to solve your own problems
francisfish has quit [Ping timeout: 240 seconds]
closures999 has joined #ruby
<certainty>
i must say though that I frequently need to look something up as well while I code
Hanmac1 has quit [Ping timeout: 265 seconds]
<DouweM>
oh, definitely
Umschwung has joined #ruby
Umschwung has quit [Max SendQ exceeded]
jamto11 has quit [Remote host closed the connection]
Umschwung has joined #ruby
Umschwung has quit [Max SendQ exceeded]
<DouweM>
but I'm still reasonably productive without it (possibly even more, without distractions like reddit and IRC), and with work I don't really have the choice to not code :P
<LadyRainicorn>
Reading documentation is 90% of coding.
<LadyRainicorn>
shevy: You lost internet*
<DouweM>
LadyRainicorn: docs can be downloaded though :)
<LadyRainicorn>
True.
Umschwung has joined #ruby
<certainty>
DouweM: oh yeah, I concentrate on the things I need. My irc session is in another console and I shutdown my email client etc.
ruby-lang665 has joined #ruby
<shevy>
yeah I can code without www connection, I have a lot of local docu; but the fun isn't there when I can not connect :(
billy_ran_away has quit [Ping timeout: 252 seconds]
toastynerd has joined #ruby
closures999 has quit [Ping timeout: 240 seconds]
lw has quit [Quit: s]
<LadyRainicorn>
Do people ever not have internet anymore?
<certainty>
shevy: does not from time to time :p
<shevy>
yes! when they have shitty providers for instance!
james_d_h has joined #ruby
foredoomed has quit [Remote host closed the connection]
<DouweM>
I like to work at night, and for "maintenance reasons" my connection goes down from like 1AM to 4AM every couple of weeks
<DouweM>
So that's annoying
bluenemo has joined #ruby
<DouweM>
But as I said, without distractions I'm actually surprisingly productive
<shevy>
hehe
<certainty>
all of us are
<DouweM>
:)
<shevy>
I am not, I only get sad without distractions :(
<certainty>
we have smileys at work that signal our coworkers the current tolerance for distractions
<DouweM>
But I make pretty heavy use of OS X desktop. I have one for Casual stuff, Work stuff and School stuff, and stuff like Reddit and IRC are only on the Casual one
<shevy>
certainty really?
<certainty>
shevy: yeah
<DouweM>
certainty: ah, I need that. Nothing is more annoying than being deep in the trenches with some problem and being called over by a coworker to help with some inane problem
<certainty>
it's super annoying when supporters step in and ask something
CharlieG has joined #ruby
<shevy>
hehehe
<certainty>
our boss is cool in that regard. He used to be a developer too
<certainty>
so he knows that programmers need time to get in a mental state where they have everything they need
<shevy>
and what is he now
<shevy>
chief monkey?
<shevy>
DRUGS
<shevy>
GIRLS
<shevy>
COFFEE
codeitagile has quit [Remote host closed the connection]
<shevy>
WORKING INTERNET CONNECTION
<ruby-lang665>
I need some help with a text-editorish thing I'm making
closures999 has joined #ruby
<certainty>
shevy: CEO
<shevy>
ruby-lang665 describe
james_d_h has quit [Ping timeout: 252 seconds]
tgkokk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<LadyRainicorn>
Ooh drugs girls coffee and internet yay!
<DouweM>
certainty: yeah, my colleagues respect that as well, I just need some way to signal to them that I'm busy *before* they call for my attention
<ruby-lang665>
My code at the moment basically reads: str = gets.chomp \n filename.syswrite(str)
<ruby-lang665>
So at the moment it's limited to just one line
<certainty>
DouweM: fair enough
codeitagile has joined #ruby
<ruby-lang665>
Anyway I could make it multi-line?
<LadyRainicorn>
That isn't valid Ruby, at all.
<shevy>
ruby-lang665 .chomp with \n wants "", so it should be changed to "\n"
<certainty>
DouweM: for us that little smiley system workes great
<DouweM>
certainty: how exactly does it work?
<ruby-lang665>
nah the comps doesnt actually have a \n in it at all, i was just using it to show 2 seperate lines of code
monsieurp has joined #ruby
<shevy>
ruby-lang665 not sure what you mean with limited to just one line; your editor makes a newline if you hit the enter key? I also am not sure what is syswrite or basically - what is your intent with that code
<certainty>
DouweM: we have piece of paper with smileys on it and an arrow that points to the currently active one. Much like a clock
<shevy>
and if it is already 2 lines, it is multi-line, is it not? :)
<ruby-lang665>
I meant the input/output is only one line
<DouweM>
certainty: ha, that's awesome. I was thinking some digital system
timonv has quit [Remote host closed the connection]
<ruby-lang665>
jhass: that looks like it should work, thank you
<DouweM>
certainty: but they'd need to walk over to see the "status"?
crystal77 has quit [Quit: Computer has gone to sleep.]
<certainty>
DouweM: they open the door which we barely realize anymore and look at the signs
monsieurp has quit [Client Quit]
Xuis_ has quit [Quit: Leaving]
<DouweM>
certainty: ah, right. we're all in one room, so there's no walking over, just shouting my name
<shevy>
DOUWEEEEEEEEEEEEEEEEEEEEEEEEM!
<DouweM>
drop the M, and yeah, pretty much
<certainty>
DouweM: eww that's bad. Put it on the wall somewhere
<shevy>
I would be a very annoying co-worker :)
<certainty>
i can imagine
<shevy>
hah I would just call you duuuuuuuuuuuude
<DouweM>
certainty: meh, we're only in the office one day a week, so the other days my productivity and concentration are great :P
<shevy>
"duuuuuuuuuude I have a problem can you heeeeeeeelp!"
<certainty>
DouweM: hah, then it's not as much of a problem
<DouweM>
shevy: shad ahp
etqqkoiflwhb___ has quit [Remote host closed the connection]
pu22l3r has quit [Remote host closed the connection]
<shevy>
haha :)
<DouweM>
certainty: communication during the rest of the week goes over skype, which has a digital equivalent of your smiley system in the form of a status :p
<certainty>
besides coworkers that aren't programmers know that it doesn't make much sense to disturb us while we're working on something. I remember when a coworker told me that he talked to me while I was noding and he literally was able to see that my mind was not present for like 30 seconds
aryaching has quit [Ping timeout: 252 seconds]
<DouweM>
:)
<certainty>
also i get mad :p
cover has quit [Remote host closed the connection]
mikepack has joined #ruby
<certainty>
of course we grant the same rights to our ops, so we're all equal there
cover has joined #ruby
<DouweM>
certainty: where do you work?
<certainty>
DouweM: a webhoster in the north of germany
<DouweM>
what do they use ruby for?
<shevy>
p0rn
<DouweM>
:')
<certainty>
that too :p
<shevy>
and selling fish
<shevy>
which needs a webshop
redlines has quit [Ping timeout: 240 seconds]
arubin has joined #ruby
redlines has joined #ruby
<shevy>
and the leftovers become fish and chips
<ruby-lang665>
Okay, everything seems to work except it's just coming out as one long string
<ruby-lang665>
how do include line breaks?
<shevy>
which gets imported into the UK
<DouweM>
ruby-lang665: show all of your code
<certainty>
DouweM: mostly to enable automation of our processes. Also we have two big internal rails apps that we use to manage our datacenter and our customers. Another rails app is facing the public as the customer interface
<DouweM>
certainty: ah, interesting
godd2 has quit [Ping timeout: 245 seconds]
<DouweM>
certainty: what's the ISP called? I'm from the Netherlands so maybe I know them
<shevy>
ruby-lang665 You must formulate your questions more accurately. If your question is: "How do I include line breaks in a string?", the answer could be via adding "\n". Like: puts "Hello\n world!"
<certainty>
and most importantly the irc bot in our internal network
Hanmac has quit [Ping timeout: 240 seconds]
<certainty>
DouweM: omc.net, i doubt you know it though.
<DouweM>
correct, never heard of it
<certainty>
heh
chipotle has quit [Quit: cya]
<DouweM>
your domains are hella expensive ;)
<certainty>
DouweM: yeah it's not the mass market we target as a company of our size can't compete with the big ones like Strato
CharlieG has quit [Ping timeout: 240 seconds]
<DouweM>
who do you target?
<certainty>
DouweM: we concentrate on managed dedicated servers and ha clusters
<DouweM>
ruby-lang665: like jhass says, you're calling two methods there, gets followed by chomp on its return value
s00pcan has joined #ruby
Hello has joined #ruby
Mongey has joined #ruby
fagianijunior has quit [Read error: Connection reset by peer]
<jhass>
ruby-lang665: also don't use :: to call methods, File::exists? -> File.exists?
mlpinit has joined #ruby
alexherbo2 has joined #ruby
<jhass>
apeiros: Mon_Ouie away_ spams
sparrovv has joined #ruby
<ruby-lang665>
I've just been following tutorialspoint and that's how they did it
<DouweM>
seconding that, away_ deserves a kick or ban
<DouweM>
ruby-lang665: then the tutorial is bad
<ruby-lang665>
Just with regards to the :: versus .
nomenkun has quit [Remote host closed the connection]
Hello has quit [Client Quit]
<DouweM>
ruby-lang665: if they're doing that, the rest can't be trusted either
<DouweM>
let's say it doesn't speak to the quality of the tutorial
<DouweM>
shut up away_
timonv has joined #ruby
<ruby-lang665>
Okay, I get you
skaflem has quit [Quit: Leaving]
<ruby-lang665>
Any idea how to fix my main problem though?
<DouweM>
ruby-lang665: as said, get rid of the chomp. and figure out what your code is actually doing by checking the links jhass provided
Advocation has quit [Quit: Advocation]
Vovko has joined #ruby
<certainty>
ruby-lang665: oneofy ourpr oble msmig htbe t heoddfor mat tin g
<jhass>
ruby-lang665: as a last tip, always use the block form of File.open (File.open(..) do |file| file.read / file.write end) or the File.read/File.write to read/write the whole file at once
<DouweM>
certainty: :)
ndrst has quit [Ping timeout: 264 seconds]
mlpinit has quit [Ping timeout: 244 seconds]
Mongey has quit [Quit: Mongey]
toastynerd has quit [Remote host closed the connection]
tvw has joined #ruby
godd2 has joined #ruby
<ruby-lang665>
Now !EXIT no longer does anything in the write method
<jhass>
ruby-lang665: what does chomp do?
<jhass>
explain that to us
<DouweM>
jhass, asking the hard questions
<ruby-lang665>
Not a novice I swear :L
<DouweM>
*tough was the word I was looking for. please accept this correction
<DouweM>
ruby-lang665: you sure about that?
<ruby-lang665>
Heavy sarcasm. I will admit, I honestly have no idea what chomp does. I just saw it, used it, went "Hey this works" and went on my merry way.
jonr22 has quit [Remote host closed the connection]
<apeiros>
jhass: what what what?
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<DouweM>
ruby-lang665: that might be your problem. read the chomp docs
<jhass>
ruby-lang665: did you yet read the documentation I linked you?
toastynerd has joined #ruby
<DouweM>
ruby-lang665: and the gets docs while you're at it
<jhass>
apeiros: away_ does query spam
FOSScookie has joined #ruby
<ruby-lang665>
Will do
<apeiros>
jhass: can't police queries, sorry. use /ignore
Vovko has quit [Ping timeout: 265 seconds]
yarou has joined #ruby
<DouweM>
apeiros: blocking them here may stop them from finding out about our existence?
<ruby-lang665>
Still, can you tell me why !EXIT no longer works if I still don't understand after reading the docs?
<jhass>
pretty sure it's a bot, but okay, I'll ask #freenode
datacrusher has joined #ruby
<apeiros>
DouweM: pointless. next step is to just have two bots. one collect the nicks, one spamming.
<apeiros>
but asking #freenode is a good idea. they can verify whether it is a bot an kline it.
deadlock has quit [Read error: No route to host]
<DouweM>
ruby-lang665: what does gets return? more specifically, what is the last character? what did chomp change about the return value of gets? why was it equal to "!EXIT" then, but now no longer?
<DouweM>
apeiros: fair enough
chrisseaton has quit []
<DouweM>
ruby-lang665: and following from that, what would you need to compare it to now, rather than to "!EXIT"?
CorpusCallosum has quit [Ping timeout: 264 seconds]
Waheedi has joined #ruby
MrPopinjay has joined #ruby
maximski has quit []
mikepack has quit [Remote host closed the connection]
shevy has quit [Remote host closed the connection]
<ruby-lang665>
The "\n" is in gets but not in chomp
Salve has quit [Remote host closed the connection]
<MrPopinjay>
Hello all. Is there a good clean way to expand an array to a certain size if it is too small?
Salve has joined #ruby
duggiefresh has quit []
cina has joined #ruby
foredoomed has joined #ruby
<DouweM>
ruby-lang665: Yay! So what would you need to compare gets to now?
<DouweM>
ruby-lang665: note that removing that \n is exactly what chomp does
<jhass>
MrPopinjay: what do you mean with too small?
sski has joined #ruby
<MrPopinjay>
Smaller than that certain size.
<DouweM>
jhass: why would you care about expanding the size of the array? reading values out of bounds returns nil anyway
<LadyRainicorn>
a += Array.new(desired-a.length) if a.length < desired
<DouweM>
LadyRainicorn: WHY though
BackEndCoder has joined #ruby
<ruby-lang665>
Got it! break if str == "!EXIT\n"
CharlieG has joined #ruby
<DouweM>
ruby-lang665: yay
<ruby-lang665>
I have the stupidest smile on my face right now
Hello has joined #ruby
<jhass>
MrPopinjay: you can assign arbitrary indicies, a = []; a[20] = "whatever". So it's really about your usecase
<DouweM>
ruby-lang665: note that in this case you could still use str.chomp == "!EXIT"
<DouweM>
ruby-lang665: it doesn't affect the str itself which does contain the "\n" at the end, so it'd still add the right string to your file
vlad_starkov has joined #ruby
<MrPopinjay>
This library I'm using outputs arrays of length 2 sometimes, but it wants an array of size 3 back. The input doesn't match the output... So I was wondering if there was a simple way to pad out arrays to a certain size
Hanmac1 has joined #ruby
<DouweM>
MrPopinjay: why do you care about the exact size of the array?
<LadyRainicorn>
Oh, a[desired] = a[desired]
<DouweM>
LadyRainicorn: nice
<MrPopinjay>
Because the library does. It drops 0s from these arrays it returns, yet it wants them back with the 0s in.
<MrPopinjay>
I think
vlad_starkov has quit [Remote host closed the connection]
lw has joined #ruby
<ruby-lang665>
IT LIVES
<DouweM>
MrPopinjay: strange. but yeah, if you really need it, use LadyRainicorn's suggestion
<ruby-lang665>
Thank you so much for your help!
<DouweM>
ruby-lang665: hahaha
Salve has quit [Ping timeout: 265 seconds]
CaptainJet has joined #ruby
maximski has joined #ruby
maximski has quit [Max SendQ exceeded]
foredoomed has quit [Ping timeout: 240 seconds]
<ruby-lang665>
A few touches I need to do for navigating dirs and displaying files but that's easy enough
<MrPopinjay>
LadyRainicorn, DouweM Thank you
Hanmac has quit [Ping timeout: 252 seconds]
<MrPopinjay>
This is annoying.
<DouweM>
ruby-lang665: also, get with indentation
<ruby-lang665>
Once again, thank you very much!
<LadyRainicorn>
It sounds like an annoying sort of library.
<ruby-lang665>
The reason for no indentation is I've been doing coding over ssh in nano
<DouweM>
ruby-lang665: nano doesn't support space bar?
<ruby-lang665>
Wanted to see if I could and then I got carried away
<ruby-lang665>
Not automatically
<DouweM>
yeah, I'm just kidding :P
<LadyRainicorn>
Wow.
<ruby-lang665>
I mean no automatic indentation
<LadyRainicorn>
Use a better editor.
<DouweM>
but still, don't try to code using nano
<LadyRainicorn>
Like ed.
<ruby-lang665>
inb4 vim
<LadyRainicorn>
;p
<MrPopinjay>
what about vi- damnit
<DouweM>
why are you devving over ssh anyway
<LadyRainicorn>
ed ftw.
<ruby-lang665>
Proof of concept
vlad_starkov has joined #ruby
Hello has quit [Remote host closed the connection]
FOSScookie has left #ruby [#ruby]
alexju has joined #ruby
axsuul has quit [Ping timeout: 240 seconds]
<jhass>
ruby-lang665: I manually indent in nano all the time
<ruby-lang665>
The machine I'm sshing into is 5 feet away from me
<jhass>
that's no excuse at all
<ruby-lang665>
It's just been a slow day
cina has quit [Quit: leaving]
<ruby-lang665>
But yeah, I'll make sure to indent next time
<havenwood>
zorak: /msg ChanServ ACCESS #ruby LIST
<zorak>
away_ is spamming me with a "weebcam en diiirecto"
<HelloWorld>
howdy havenwood
MrPopinjay has quit [Quit: leaving]
<havenwood>
HelloWorld: hi
LinearInterpol has quit [Remote host closed the connection]
jjbohn has quit [Quit: Leaving...]
<zorak>
havenwood: away_ is spamming me with a weebcam en diiirecto [LINK] message
tjr9898__ has quit [Remote host closed the connection]
Wolland has joined #ruby
<certainty>
zorak: ignore it
<droptone>
question: we're interested in usig jplayer in our rails 3.2 app, I've deployed the jplayer gem that adds it to the asset pipeline, but I cannot find any demonstraitons of how to actually implement jplayer in ruby code.
<havenwood>
zorak: i meant that is the command to see the channel operators, do /ignore away_
chuk has joined #ruby
<droptone>
Does anyone have any examples of how to implement jplayer?
toastynerd has quit [Remote host closed the connection]
visof has quit [Ping timeout: 240 seconds]
chrisseaton has quit []
Ziarkaen has joined #ruby
<LadyRainicorn>
jplayer is all JS.
<LadyRainicorn>
You don't use any Ruby code, except maybe to serve the video.
<hidensoft>
hi guys, i'm trying to install ruby with rbenv , i got this , uncommon.mk:180: recipe for target 'build-ext' failed ,what is that mean ? archlinux/x86_64
chris_thomson has joined #ruby
codeitagile has joined #ruby
chipotle has joined #ruby
chipotle has quit [Client Quit]
<atmosx>
TuxLyn: rescue
<TuxLyn>
atmosx, thanks I just got it ^_^
<atmosx>
TuxLyn: begin/rescue/end
<TuxLyn>
I used rescue Exception => e
<atmosx>
TuxLyn: es, that's generic. Can be way more specific
sigurding has quit [Quit: sigurding]
<vjt>
TuxLyn: be careful with rescue Exception, as that will swallow all possible errors, and is not what you want
<TuxLyn>
actually I just needed rescue Exception :)
<TuxLyn>
to ignore any errors :)
yubrew has joined #ruby
<TuxLyn>
because my match's was trowing errors if its empty
<TuxLyn>
so now it ignores when there is no value
<vjt>
then a better approach is to better build your match :)
Speed has joined #ruby
<TuxLyn>
what is all this private messages from away_ ?
mourest has quit [Remote host closed the connection]
jackneill has quit [Ping timeout: 240 seconds]
glosoli has joined #ruby
<certainty>
TuxLyn: ignoring is quite direct
mojjojo has joined #ruby
axl_ has joined #ruby
sambao21 has quit [Quit: Computer has gone to sleep.]
<TuxLyn>
^_^ indeed
tectonic has joined #ruby
Vovko has quit [Remote host closed the connection]
chris_thomson has joined #ruby
CharlieG_ has joined #ruby
sepp2k1 has joined #ruby
<pontiki>
although it does not have the visceral appeal that would ease one's bloodlust
<apeiros>
certainty: it's missing the screaming due to burning of the spammer, though
<pontiki>
that's another way of saying it
* apeiros
gets killed in skyrim :(
sepp2k has quit [Ping timeout: 244 seconds]
<certainty>
apeiros: yeah, didn't say it was as much as fun ;)
albedoa has joined #ruby
<apeiros>
how come they give you missions in the very first town which you can't possibly beat the next 15 levels? :-S
<pontiki>
arrow to the fricken knee, man, arrow to the fricken knee
<TuxLyn>
Any one knows how to do file-based ignore list ? Something like filter list based on array or a list.
Speed has joined #ruby
<TuxLyn>
I want to have a list of keywords that will be ignored.
diegoviola has joined #ruby
jamto11 has joined #ruby
<pontiki>
not quite sure what you're asking there
toastynerd has quit [Remote host closed the connection]
<pontiki>
you'd need the list in your code to do the compare
<TuxLyn>
for example if I have ignore.txt file and have keywords there like one, two, three
<pontiki>
do just want a way to save it between executions?
lw has quit [Read error: Connection reset by peer]
CharlieG has quit [Ping timeout: 240 seconds]
<pontiki>
you could use a yaml file, forexample
<TuxLyn>
then when I do my match's in code I then do something like; next if title =~ /key/i
CorySimmons has joined #ruby
lw has joined #ruby
sambao21 has joined #ruby
<TuxLyn>
haven't tried yaml, but still I just want to have simple txt file of keywords that I can use as ignore list.
marcdel has quit []
Klumben has quit [Remote host closed the connection]
<TuxLyn>
So whenever I do match's it checks agains this list and skips
Hobogrammer has quit [Read error: Connection reset by peer]
<pontiki>
no matter, you still need to have the list of words in an array
CharlieG_ has quit [Ping timeout: 240 seconds]
<TuxLyn>
yeah
<pontiki>
figure that out first, then you can figure out how to store/retrieve the list of words
Fyyr13_ has joined #ruby
<TuxLyn>
actually I have something simular I use already in one of my scripts, I will try to use same aproach for this
pskosinski has quit [Quit: Til rivido Idisti!]
<TuxLyn>
in other script I have list of uuids script always checks
toastynerd has joined #ruby
<TuxLyn>
if it already exists it skips it
<TuxLyn>
I'm using > if File.readlines(txt).grep(/#{uuid}/).empty?
<TuxLyn>
so I'll try to do the same for ignore list ^_^
CorySimmons has quit [Ping timeout: 252 seconds]
monkegjinni has joined #ruby
albedoa has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sigurding has joined #ruby
lw has quit [Quit: s]
Fyyr13_ has quit [Ping timeout: 240 seconds]
_lynX has joined #ruby
<certainty>
TuxLyn: note that this will do more work than needed as .grep will go through all lines
centrx has joined #ruby
<TuxLyn>
yes but I will have seperate filter.txt file this way that I can have many keywords in
armyriad has quit [Read error: Connection reset by peer]
<certainty>
TuxLyn: yeah that's not my point though :)
armyriad has joined #ruby
UserNameInvalid has quit [Ping timeout: 252 seconds]
<TuxLyn>
I kind of have an idea of what I need to do :) But if I get stuck I'll try asking here ^_^
tjr9898 has joined #ruby
workmad3 has quit [Ping timeout: 244 seconds]
Klumben has joined #ruby
Abyss-- has quit [Read error: Connection reset by peer]
WormDrink has quit [Ping timeout: 240 seconds]
Abyss-- has joined #ruby
jonr22 has joined #ruby
tvw has quit [Ping timeout: 265 seconds]
tjr9898_ has joined #ruby
Mongey has joined #ruby
pwh_ has quit [Ping timeout: 265 seconds]
Slavox is now known as Slavox|AFK
CharlieG has joined #ruby
yubrew has joined #ruby
jjbohn has quit [Quit: Leaving...]
kennym has joined #ruby
alexherbo2 has joined #ruby
marcoecc has joined #ruby
VTLob has joined #ruby
WormDrink has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
james_d_h has joined #ruby
Wolland has quit [Remote host closed the connection]
yubrew has quit [Ping timeout: 264 seconds]
<rs0>
I don't understand the behavior of http://pastebin.com/k1cGxkzz (closing a pipe across process vs across Ruby threads). Can someone explain what the story is here?
Brando753 has quit [Ping timeout: 255 seconds]
Wolland has joined #ruby
Oog has joined #ruby
peterhellberg has quit [Remote host closed the connection]
<Oog>
in ensure is there a way to tell if an exception has been thrown?
senayar_ has joined #ruby
larsam has quit [Ping timeout: 264 seconds]
shevy has joined #ruby
armyriad has quit [Ping timeout: 240 seconds]
timonv has joined #ruby
senayar has quit [Read error: Operation timed out]
<centrx>
rs0, Docs say "If ios is a stream such as pipe or socket, IO#eof? blocks until the other end sends some data or closes it."
albedoa has joined #ruby
<shevy>
DouweM!
jackneill has joined #ruby
<shevy>
I think my internet works again
<certainty>
Oog: if you want to know you can just catch it
<rs0>
centrx: right. and in the case where the pipe goes across Ruby threads, eof eventually returns
workmad3 has joined #ruby
<shevy>
it is too soon to call it final but I can browse on the www again
axsuul has joined #ruby
montyboy_ has joined #ruby
<rs0>
centrx: but if the pipe connects two processes (the parent and the child), #eof? blocks forever. i tried it on at least three different rubies
Slavox|AFK is now known as Slavox
UserNameInvalid has joined #ruby
hiyosi has quit [Read error: Operation timed out]
<Beoran>
rs0, it might be better to use select() for such cases
_Rahul_Roy_ has joined #ruby
Wolland has quit [Ping timeout: 265 seconds]
<Beoran>
then you can poll
Mongey has quit [Quit: Mongey]
crystal77 has quit [Quit: Computer has gone to sleep.]
<Beoran>
for any incoming input
<toretore>
rs0: the program demonstrates that when you fork, the child's r and w are not the same objects as those in the parent
senayar has joined #ruby
senayar has quit [Remote host closed the connection]
senayar_ has quit [Read error: Connection reset by peer]
Ziarkaen has quit [Ping timeout: 264 seconds]
<centrx>
apeiros, away_ is spamming
<rs0>
toretore: when you put it that way, it seems so obvious
Mongey has joined #ruby
<rs0>
toretore: what's the proper way to do this, then?
<toretore>
what is it you want to do?
<shevy>
away_ must be banned
<rs0>
well, i'm trying to fork another process that can act as an *unlimited* buffer for stdin, since using select(2) to poll means that the input process will stop once the buffer fills up (and resume when it's writeable again)
<TuxLyn>
shevy, I agree ^_^
Brando753 has joined #ruby
<rs0>
and i'm specifically trying to do it with a fork, instead of threads and queues
<certainty>
shevy: so you got the interwebs back?
<hidensoft>
omg , ruby installed
<shevy>
it's a bot spamming with different URLs, it's the first time I had to use /ignore :(
<shevy>
certainty for now!
<shevy>
but I am not sure if it will be up for more than one hour
UserNameInvalid has quit [Ping timeout: 240 seconds]
_Rahul_Roy_ has quit [Client Quit]
<shevy>
I have a full week ahead with appointments and meetings every day, can't again afford to lose time on the weekend like that :(
<toretore>
rs0: in the parent, close r, in the child, close w
<toretore>
then w.write(STDIN.read) in parent, buffer << r.read in child
Zespre has joined #ruby
<certainty>
shevy: that's due to QoS settings on this channel, which disconnects you on a certain interval to assure quality :p
<rs0>
toretore: nailed it! thanks
dkamioka has quit [Remote host closed the connection]
aspires has joined #ruby
relix has joined #ruby
thesheff17_ has quit [Ping timeout: 252 seconds]
<shevy>
certainty haha IRC was one of the few things that still worked
Slavox is now known as Slavox|AFK
<certainty>
:)
thesheff17_ has joined #ruby
sabeur has joined #ruby
<shevy>
damn
<shevy>
it's down again :(
sdouglas has quit [Remote host closed the connection]
<LadyRainicorn>
aw ;-;
Hobogrammer has joined #ruby
<apeiros>
*sob*
james_d_h has quit [Ping timeout: 265 seconds]
<apeiros>
centrx: for you too, I only police this channel. I can't help with people spamming your query. sorry.
diegoviola has quit [Quit: WeeChat 0.4.3]
DrShoggoth has quit [Quit: Leaving]
blackmesa has joined #ruby
<centrx>
apeiros, The nick is in this channel, he might be spamming others
<shevy>
I think away_ obtains a channel list
<apeiros>
centrx: did he do anything wrong *in this channel*? no? then I can't do anything. simple as that.
lw has joined #ruby
<centrx>
I guess you have some pretty strict rules about your opering
<shevy>
but info available from cross posting also makes use of information available outside another channel apeiros ;)
<apeiros>
shevy: cross-posting in this channel is doing something wrong *in this channel*.
<apeiros>
I'm not responsible for managing your private messages. also, kicking/banning him is pointless anyway. it's trivial to have more than 1 bot and share nicknames.
<RubyPanther>
shevy: I went over a decade without using ignore until a couple years ago, and then it took like 15 ignore rules to make the creature disappear
pwh has joined #ruby
Wolland has joined #ruby
shabgrd has joined #ruby
<RubyPanther>
shevy: you can make a report in #freenode
away_ has quit [K-Lined]
armyriad has quit [Client Quit]
meatherly has joined #ruby
<RubyPanther>
depending who is around, they either get banned right away, or nothing happens
chipotle has joined #ruby
claymore has quit [Ping timeout: 240 seconds]
tectonic has quit []
pothibo has joined #ruby
onewheelskyward has joined #ruby
Hobogrammer has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 240 seconds]
shabgard has quit [Ping timeout: 240 seconds]
Mongey has quit [Quit: Mongey]
onewheelskyward has quit [*.net *.split]
michael_lee has quit [Quit: Ex-Chat]
pfg has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
claymore has joined #ruby
camilasan has quit [Quit: Konversation terminated!]
chipotle has quit [Client Quit]
alexju has joined #ruby
closures999 has quit []
lw has quit [Quit: s]
Wolland has quit [Ping timeout: 265 seconds]
timonv has quit [Remote host closed the connection]
thesheff17_ has joined #ruby
<shevy>
looks as if the bot is gone
francisfish has joined #ruby
carif has joined #ruby
einarj has joined #ruby
Wolland has joined #ruby
einarj has quit [Remote host closed the connection]
pfg has joined #ruby
einarj has joined #ruby
morenoh149 has quit [Ping timeout: 244 seconds]
monkegjinni has quit [Remote host closed the connection]
francisfish has quit [Ping timeout: 252 seconds]
aspires has quit []
lw has joined #ruby
monkegjinni has joined #ruby
lolmaus_ has joined #ruby
yubrew has joined #ruby
aspires has joined #ruby
lolmaus has quit [Ping timeout: 265 seconds]
agjacome has quit [Quit: leaving]
LadyRainicorn has quit [Ping timeout: 240 seconds]
chrisseaton has quit []
monkegjinni has quit [Ping timeout: 264 seconds]
yubrew has quit [Ping timeout: 244 seconds]
toastynerd has quit [Remote host closed the connection]
sigurding has quit [Quit: sigurding]
chrisseaton has joined #ruby
sabeur has quit []
vlad_starkov has joined #ruby
Xaitec has joined #ruby
onewheelskyward has joined #ruby
Hobogrammer has joined #ruby
zarul has quit [Quit: Leaving]
arietis has quit [Quit: Computer has gone to sleep.]
<n88_>
so i've written a css scraper with mechanize and i'm pulling data directly into a mysql db.... it must be the slowest thing ever written by a human and executed by a computer... what are my options for speeding this up ?
<tongcx>
havenwood: thanks
Speed has quit [Ping timeout: 240 seconds]
<soahccc>
havenwood: is rainbows that much better? we survived a TV-spot with just one server nginx + unicorn :D
aspires has quit []
klaut_ has quit [Remote host closed the connection]
<soahccc>
n88_: look what is slow and try to improve these parts. at the end parallelizing is my usual way to go
morenoh149 has joined #ruby
<soahccc>
n88_: Usually you can pull steps apart and handle them independently but this heavily depends on the situation
<havenwood>
soahccc: Rainbows::XEpollThreadPool etc are pretty nice, but Nginx is blazing fast and good at what it does
tjr9898_ has quit [Remote host closed the connection]
aeio has quit [Quit: Leaving]
<n88_>
hmm.. i think the process as a whole is just slow (has to make multiple http requests to get all the necessary info for each line)
<soahccc>
havenwood: ahh so it would be instead nginx rather than instead unicorn?
<havenwood>
soahccc: Instead of both, it is unicorn paired with an evented thread pool.
<soahccc>
n88_: break it apart if possible, one part pulls the source needed and the other asynchronously gathers more remote data. that could(!) be a way
<soahccc>
havenwood: ahh okay…
<havenwood>
soahccc: well, XEpollThreadPool is - there are a variety of Rainbows! options: http://rainbows.rubyforge.org/
zcreative has joined #ruby
<soahccc>
havenwood: hmm I think I still let nginx throw out the images :D
BuSerD has quit [Read error: Connection reset by peer]
<havenwood>
soahccc: good way to do it! but fun to have pure Ruby options ;)
e4xit has quit [Quit: e4xit]
NicholasFlamel has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
einarj has quit [Remote host closed the connection]
JBreit has joined #ruby
Slavox|AFK is now known as Slavox
mackworth has quit [Quit: Page closed]
carif has quit [Quit: Ex-Chat]
<havenwood>
is my Rack ecosystem list missing anything obvious?: Reverse Proxy (Nginx Apache) -> Rack Webserver (Unicorn Rainbows! Thin Puma Passenger Webrick Reel-Rack) -> Rack (Rack and any middlewear) -> Rack Framework (Rails Sinatra NYNY Ramaze Camping Scorched)
NicholasFlamel has joined #ruby
tgkokk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
meatherly has quit [Remote host closed the connection]
JBreit has left #ruby [#ruby]
meatherly has joined #ruby
Tachoh has quit [Ping timeout: 252 seconds]
Xeago has joined #ruby
e4xit has joined #ruby
minasmazar has quit [Quit: Konversation terminated!]
Slavox is now known as Slavox|AFK
DouweM has joined #ruby
sdouglas has quit [Remote host closed the connection]
aspires has joined #ruby
<soahccc>
havenwood: no, did you know that every controller is a standalone rack app?
meatherly has quit [Ping timeout: 244 seconds]
<soahccc>
havenwood: I should go to sleep, I meant yes :<
zorak has quit [Read error: Connection reset by peer]
Speed has joined #ruby
axsuul has quit [Ping timeout: 240 seconds]
agjacome has joined #ruby
hiyosi has joined #ruby
godd2 has joined #ruby
Slavox|AFK is now known as Slavox
phansch has quit [Quit: WeeChat 0.4.2]
Abyss-- has quit [Ping timeout: 265 seconds]
rococo has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<garbagecollectio>
why not do a class within a class instead of a class within a module
<garbagecollectio>
i guess it comes down if that top level would ever be instantiated
<Mon_Ouie>
You could, but then you'd also be able to create an instance of that module. And if its sole purpose is nesting that doesn't really make sense.
andrewlio has quit [Quit: Leaving.]
<garbagecollectio>
awesome! so helpful
monkegjinni has quit [Ping timeout: 252 seconds]
workmad3 has joined #ruby
<garbagecollectio>
whats a good use for helper methods
<garbagecollectio>
with regards to the controller
<jhass>
now you're mixing rails with ruby
<garbagecollectio>
like I'm setting up a view that calls a helper method with the input being a instance variable and it does processing
<garbagecollectio>
thats true is that forbidden here?
<jhass>
it's better to ask rails questions in #rubyonrails
<Mon_Ouie>
No (you're asking about Ruby concepts mostly anyway), just keep in mind the concepts are more general than that
nhhagen has quit [Ping timeout: 240 seconds]
fightback has quit [Ping timeout: 240 seconds]
alexherbo2 has joined #ruby
<garbagecollectio>
i can't get in there for some reason
<jhass>
garbagecollectio: /msg NickServ help
<garbagecollectio>
i am registered
<garbagecollectio>
it says I'm banned but I've never been there before lol
pyreal has joined #ruby
<garbagecollectio>
i guess what are the use cases for helper methods
s2013 has joined #ruby
<garbagecollectio>
that is valid architecture
<s2013>
lets say i have a hash. each hash is an array. i want to get sum of the size of all the arrays in the hash
<s2013>
whats the ideal way
<garbagecollectio>
besides just doing processing in the view
nhhagen has joined #ruby
dkamioka has quit [Read error: Connection reset by peer]
xuisc has quit []
mojjojo has quit [Quit: mojjojo]
vlad_starkov has joined #ruby
shevy has joined #ruby
<jhass>
s2013: hash.values.map(&:size).inject(:+)
<Mon_Ouie>
Things you need to do in various places of your code, logging for instance
dkamioka has joined #ruby
nateberkopec has joined #ruby
dkamioka has quit [Remote host closed the connection]
hobodave has joined #ruby
saarinen has joined #ruby
<s2013>
thanks jhass
nhhagen has quit [Ping timeout: 240 seconds]
fgo has joined #ruby
MattStratton has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
vlad_starkov has quit [Ping timeout: 240 seconds]
jetblack has quit [Quit: leaving]
armyriad has quit [Ping timeout: 240 seconds]
cjsarette has quit [Ping timeout: 245 seconds]
ktosiek has quit [Ping timeout: 244 seconds]
nateberkopec has quit [Ping timeout: 240 seconds]
<garbagecollectio>
Mon_Ouie: can helper methods call other helper methods
<garbagecollectio>
is that valid architecture
mojjojo has joined #ruby
axl_ has quit [Quit: axl_]
tesuji has quit [Ping timeout: 240 seconds]
visof has joined #ruby
chipotle has joined #ruby
cjsarette has joined #ruby
duggiefresh has quit [Ping timeout: 252 seconds]
stephenmac7_ is now known as stephenmac7
Shidash has joined #ruby
<albedoa>
probably a bash question, but maybe you guys can help: when i type `rspec --color --format doc .` it runs all of my tests, but then if i make an alias `alias rs=rspec --color --format doc` and then type `rs .' it hangs. any idea why?
monkegjinni has joined #ruby
<RubyPanther>
albedoa: usually you need to quote the right hand side of the alias
m104 has quit [Quit: brb]
whomp has joined #ruby
<RubyPanther>
if there are spaces, etc
<albedoa>
RubyPanther whoops, i did.
<albedoa>
improperly copied it to irc
poguez has joined #ruby
<whomp>
having an interesting design problem. i'm working with a library that outputs an instance of one of two classes depending on the situation. i want to handle both with the same method calls, because they share lots of properties that are accessed differently (one with hash syntax, the other with mostly method calls). how would you guys do this?
Ziarkaen has joined #ruby
<crome>
your library should output stuff that respond to the same messages
<RubyPanther>
whomp: I would put the common parts in a mixin module, using Enumerable as a baseline
chipotle has quit [Ping timeout: 265 seconds]
fudanchi1 has quit [Quit: #LaLaLaYeYeYe]
<RubyPanther>
and for example things that the class has to define, I would put in the mixin versions that raise an error 'not implemented'
<whomp>
RubyPanther, perfect!
trhodes_ has joined #ruby
<whomp>
i had created a wrapper class, and then i'd set the variables manually and keep a pointer to the original object
visof has quit [Ping timeout: 269 seconds]
<whomp>
but it was getting annoying with things like equality testing
<whomp>
so yeah, thanks lol
jtza8 has quit [Quit: Night all.]
<whomp>
also, RubyPanther what do you mean, using Enumerable as a baseline?
<RubyPanther>
whomp: sorry, poorly phrased, I just meant as an example
dkamioka has joined #ruby
<whomp>
oh, ok
nateberkopec has joined #ruby
<RubyPanther>
where it uses the #each from the class that includes it
<whomp>
so a class will declare that it implements enumerable?
chipotle has joined #ruby
<RubyPanther>
>> class Foo; include Enumerable; def each; yield :omg end end ; Foo.new.first
<jhass>
I think I'd just class Foo; def initialize target; @target = target; @access_via_brackets = target.respond_to? :[]; end; def [] key; if @access_via_brackets; @target[key]; else; @target.public_send key; end; end; end;
<garbagecollectio>
so i have a design problem
<garbagecollectio>
i have a cms
<garbagecollectio>
that basically updates stuff in the view layer
<garbagecollectio>
its a library
<garbagecollectio>
that basically does database calls
NicholasFlamel has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<RubyPanther>
garbagecollectio: it is out of fashion to let view layers do any sort of useful work, especially updating things
bthesorceror has joined #ruby
<garbagecollectio>
ok
nateberkopec has quit [Ping timeout: 240 seconds]
Salve_ has quit [Remote host closed the connection]
<garbagecollectio>
RubyPanther: so say my cms has a class that has data
<RubyPanther>
garbagecollectio: generally you should have some sort of domain object that is responsible for the update, like in a CMS I often have CMSFragment or something like that that holds basically all the logic.
<garbagecollectio>
that gets data from the database via a model
sdouglas has quit [Remote host closed the connection]
Salve has joined #ruby
machindo has joined #ruby
lkba has quit [Ping timeout: 240 seconds]
ndrei has quit [Ping timeout: 240 seconds]
sdouglas has joined #ruby
<garbagecollectio>
RubyPanther: what do u mean? so this library is literally just methods that lets me get data from the db
ndrei has joined #ruby
<garbagecollectio>
RubyPanther: and the way i do is i pass in the page name that is being viewed and then a specific ID
<RubyPanther>
garbagecollectio: Your description sounds like a procedural programming structure instead of OOP
<garbagecollectio>
well this is how they have us building it
<RubyPanther>
a library should provide classes or modules, not methods
<garbagecollectio>
classes can have methods right?
<garbagecollectio>
ur saying ur not supposed to be able to call them?
<garbagecollectio>
it goes in lib folder
<garbagecollectio>
and basically i get all this data and then print it on the page
shevy has quit [Ping timeout: 244 seconds]
<RubyPanther>
No, I'm saying that a library should be a "class" which has methods, but that isn't the point; being able to instantiate instances is then the point. Or a module, with mixin methods, and then the interface is important, but it isn't just a bag of methods. You would want the methods to get mixed into a class and used there, not just call methods in a library
<RubyPanther>
when I hear "library" I'm hearing alarm bells :)
Salve has quit [Ping timeout: 264 seconds]
Slavox|AFK is now known as Slavox
<jhass>
garbagecollectio: what RubyPanther is getting at (I think) is that you should do page= CMS.get_page('foo'); page.title, page.body; instead of CMS.get_title_for('foo'); CMS.get_body_for('foo');
marcdel has quit []
nateberkopec has joined #ruby
<RubyPanther>
Yes, thanks jhass :)
<godd2>
Can I make an IO object where the output is some string in memory?
<RubyPanther>
godd2: See: StringIO
<jhass>
godd2: I think you want StringIO
yubrew has joined #ruby
<godd2>
thank you very much :)
marcdel has joined #ruby
visof has joined #ruby
axsuul has quit [Read error: Connection reset by peer]
axsuul has joined #ruby
yano has joined #ruby
roolo has quit [Quit: Leaving...]
alexherbo2 has quit [Ping timeout: 264 seconds]
jamto11 has quit []
yubrew has quit [Ping timeout: 240 seconds]
<garbagecollectio>
RubyPanther: like what is this doing: #mo-main-content.module{ :data => {'module' => Display::Constants::EModule[:MAIN_CONTENT]}}
klaut_ has joined #ruby
<garbagecollectio>
what is that :MAIN_CONTENT
<jhass>
a Symbol
<jhass>
it's rare to see them all caps though
<garbagecollectio>
with no value?
<jhass>
a Symbol is a value
<garbagecollectio>
i mean there is nothing there
<garbagecollectio>
oh
<RubyPanther>
a symbol being passed to the module method [] on EModule, it is nasty for a few reasons
<jhass>
much like a String, except not garbage collected and meant to represent something, much like a enum in other languages
<garbagecollectio>
right right
whomp has quit [Ping timeout: 265 seconds]
<garbagecollectio>
the module method is []
<garbagecollectio>
??
<garbagecollectio>
oh unless she has this as an array
<RubyPanther>
unless EModule is a method :)
jimmyy has joined #ruby
<garbagecollectio>
yeah see this is why i was asking u all these questions actually
<garbagecollectio>
about ::
<jhass>
or a constant not pointing to module or class
<garbagecollectio>
i didn't understand if this was
duggiefresh has joined #ruby
<jhass>
check what Display::Constants::EModule.inspect says
<RubyPanther>
:: can also separate a module/class method but it is poor style
whomp has joined #ruby
lkba has joined #ruby
oneawayman has quit [Read error: Operation timed out]
Xaitec has left #ruby [#ruby]
chipotle has quit [Ping timeout: 240 seconds]
mcus has joined #ruby
machindo has quit [Quit: machindo]
mercwithamouth has joined #ruby
lutfidemirci has joined #ruby
<RubyPanther>
at least on current Ruby, it can't be a method in this case, it would need parens
<jhass>
I'm betting on Hash assigned to constant
jeregrine has joined #ruby
<jhass>
garbagecollectio: is Display::Constants.constants.include? :EModule true or false?
<jhass>
(yes, that's effectively your first example)
<garbagecollectio>
get_page.get_widgets_at
<garbagecollectio>
thats a little weird
<garbagecollectio>
is this not weird coding?
<RubyPanther>
lol awesome
xuisc has quit [Client Quit]
xuisc has joined #ruby
xuisc has joined #ruby
xuisc has quit [Changing host]
<jhass>
naming methods get_something is already considered weird in ruby, garbagecollectio
momigi has joined #ruby
<jhass>
and as we said, using :: to call methods is discouraged
<garbagecollectio>
but she isnt
<garbagecollectio>
she is calling . to call the method on a class
<jhass>
but chaining method calls? not weird at all
<RubyPanther>
garbagecollectio: it is typical where you're passing in an object and you want to keep the logic out of the view and in a helper. I often will have things like <%= cms_fragment_for( @user, :menu ) %>
<garbagecollectio>
right
sambao21 has quit [Quit: Computer has gone to sleep.]
<garbagecollectio>
that i am fine with
<garbagecollectio>
that makes sense
visof has quit [Ping timeout: 240 seconds]
FenixFyreX has joined #ruby
tjr9898__ has quit [Ping timeout: 265 seconds]
chipotle has joined #ruby
agjacome has joined #ruby
perlsyntax has joined #ruby
francisfish has quit [Ping timeout: 240 seconds]
bigmac has quit [Ping timeout: 240 seconds]
perlsyntax has left #ruby [#ruby]
iparnose has joined #ruby
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mjs2600 has joined #ruby
perlsyntax has joined #ruby
<FenixFyreX>
Can anyone help with building the glfw3 gem on windows? I can't figure it out..
<RubyPanther>
garbagecollectio: so you need to look up 2 things, site/pages_helper (the last :: there separates a method ) and also display/constants for EModule
<garbagecollectio>
i found that
<garbagecollectio>
get_page seems to return PagesCache.get_page(slug)
<RubyPanther>
garbagecollectio: so it gets a Page instance, and then calls get_widgets_at( ... ) on it
<garbagecollectio>
so now i have to find this display::constants thing
duggiefresh has quit [Ping timeout: 244 seconds]
duggiefresh has joined #ruby
burgess|vayo has joined #ruby
vlad_starkov has joined #ruby
sailias has joined #ruby
<garbagecollectio>
oh
<garbagecollectio>
this is what the code is
<garbagecollectio>
Enum.net
<garbagecollectio>
EModule = Enum.new
mjs2600 has quit [Remote host closed the connection]
axsuul has quit [Read error: Connection reset by peer]
<garbagecollectio>
EModule = Enum.new(
<garbagecollectio>
"DRAWER" ,
<RubyPanther>
so it is hash-like
axsuul has joined #ruby
<garbagecollectio>
what does Enum.new do?
randomnick_ has quit [Quit: Leaving]
axsuul has quit [Max SendQ exceeded]
<jhass>
not a core/stdlib/rails class afaik
axsuul has joined #ruby
monkegjinni has quit [Remote host closed the connection]
nhhagen has quit [Ping timeout: 245 seconds]
monkegjinni has joined #ruby
<RubyPanther>
it is a nasty rails things designed to sow confusion by naming something Enum to be used by ORMs, but that is different from the db enums people might also be using
axsuul has quit [Read error: Connection reset by peer]