<waxjar>
it's cool as an experiment, but not very useful since Ruby is dynamic by nature
DanKnox_away is now known as DanKnox
cj3kim has quit [Ping timeout: 256 seconds]
phipes has quit [Quit: phipes]
showtime has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
lethjakman has quit [Ping timeout: 276 seconds]
ggordan has quit [Remote host closed the connection]
dustint has joined #ruby
<kenneth>
right, but that said most functions in practice would break in more or less bad ways when not following the implied type contract (usually only specified in documentation)
<waxjar>
all you should care about is that it responds to some method (if you intend to call a method on it), it gives you a lot of flexibility
Xeago has quit [Remote host closed the connection]
<MrZYX>
for example passing a StringIO instead of a File while testing
phipes has joined #ruby
eykosioux has joined #ruby
falood has joined #ruby
freakazoid0223 has joined #ruby
w|t has joined #ruby
akells` has quit [Remote host closed the connection]
chipotle_ has joined #ruby
huoxito has joined #ruby
eykosioux has quit [Ping timeout: 256 seconds]
DanKnox is now known as DanKnox_away
poga has joined #ruby
chipotle_ has quit [Quit: cya]
slocate has quit [Quit: EPIC5-1.1.5[1683] - amnesiac : The fatter they are, the fatter they fall]
roadt has joined #ruby
mercwithamouth has joined #ruby
dustint has quit [Quit: Leaving]
krainboltgreene has quit [Ping timeout: 240 seconds]
krainboltgreene has joined #ruby
Cache_Money has quit [Ping timeout: 256 seconds]
lewix has quit [Remote host closed the connection]
<MrZYX>
maybe let it also inherit from Logger so it passes all eventual .is_a? Logger checks
kofno has joined #ruby
hogeo has quit [Remote host closed the connection]
hogeo has joined #ruby
cj3kim has quit [Remote host closed the connection]
dhruvasagar has joined #ruby
mduvall has quit [Quit: mduvall]
johnkary has quit [Quit: @johnkary]
falood has quit [Remote host closed the connection]
nkts has quit [Read error: Connection reset by peer]
nkts has joined #ruby
jmeeuwen has quit [Ping timeout: 276 seconds]
atno__ has quit [Ping timeout: 264 seconds]
decentrality has quit [Quit: decentrality]
showtime has joined #ruby
cheese1756 has quit [Excess Flood]
iamjarvo1 has joined #ruby
arya has joined #ruby
rakl has joined #ruby
<stewart_>
MrZYX: HAHA "HydraLogger" I love it. I also like the loop and define. I was thinking to implement each method explicitly but your solution is more elegant than that. Thanks for this one. Will put it in to the code base :)
cheese1756 has joined #ruby
tjbiddle has joined #ruby
banghouse has quit [Remote host closed the connection]
Guedes has quit [Ping timeout: 256 seconds]
mercwithamouth has joined #ruby
DonRichie has quit [Ping timeout: 256 seconds]
Ontolog has joined #ruby
DonRichie has joined #ruby
Bry8Star has quit [Write error: Connection reset by peer]
atmosx has quit [Write error: Broken pipe]
nari has quit [Ping timeout: 240 seconds]
Johbe has quit [Ping timeout: 246 seconds]
noname001 has quit [Remote host closed the connection]
tommyvyo has quit [Quit:]
Johbe has joined #ruby
atmosx has joined #ruby
kofno has quit [Remote host closed the connection]
fermion has joined #ruby
iamjarvo1 has quit [Quit: Leaving.]
mfridh has quit [Read error: Connection reset by peer]
lyanchih has joined #ruby
Davey has quit [Quit: Computer has gone to sleep.]
DrHeiter23 has quit [Quit: DrHeiter23]
jmeeuwen has joined #ruby
mogsy has joined #ruby
kofno has joined #ruby
eliasp has quit [Ping timeout: 245 seconds]
atno__ has joined #ruby
jamie_ca_ has joined #ruby
fermion has quit [Quit: Computer has gone to sleep.]
falood has joined #ruby
jbueza has quit [Quit: Leaving.]
Banistergalaxy has quit [Ping timeout: 248 seconds]
havenwood has quit [Remote host closed the connection]
Banistergalaxy has joined #ruby
yshh has joined #ruby
reisl has joined #ruby
eykosioux has joined #ruby
sepp2k1 has quit [Read error: Connection reset by peer]
phipes has quit [Quit: phipes]
eka has quit [Quit: Computer has gone to sleep.]
Bry8Star has joined #ruby
eliasp has joined #ruby
hamakn has quit [Remote host closed the connection]
krainboltgreene has quit [Ping timeout: 252 seconds]
jamie_ca_ has quit [Quit: Computer has gone to sleep.]
roadt has quit [Ping timeout: 248 seconds]
nettoweb has joined #ruby
showtime has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
roadt has joined #ruby
mduvall has joined #ruby
jamesfung14 has joined #ruby
jamesfung14 has quit [Client Quit]
vlad_starkov has joined #ruby
nari has joined #ruby
eykosioux has quit [Ping timeout: 256 seconds]
maetthew has joined #ruby
ravster has left #ruby [#ruby]
cj3kim has joined #ruby
alexgordon has quit [Quit: Computer has gone to sleep.]
<arubin>
kenneth: How does that make Rails pure evil?
rads has quit [Quit: rads]
subbyyy has quit [Ping timeout: 264 seconds]
<kenneth>
arubin: the fact that it requires a secret token is an example of horrible design, something endemic to the framework
<fivetwentysix>
kenneth: how does cakephp do it?
<arubin>
kenneth: So it should not sign cookies?
<fivetwentysix>
or django
<AgentWillyWonka>
This is a AWS use case which can be applied to all frameworks ...
<kenneth>
no idea, i don't use either of those frameworks
<kenneth>
but it should not trust cookies
<kenneth>
and untrusted cookies do not require to be signed
<arubin>
When you create a new Django project using startproject, the settings.py file is generated automatically and gets a random SECRET_KEY value. This value is the key to securing signed data – it is vital you keep this secure, or attackers could use it to generate their own signed values.
<fivetwentysix>
kenneth: my point is simply how do you know if it's bad if you have nothing to compare it to
<arubin>
So Django is exactly the same.
<fivetwentysix>
exactly.
hogeo_ has joined #ruby
bradhe has joined #ruby
subbyyy has joined #ruby
Leighton has joined #ruby
<kenneth>
there's plenty to compare it to. there's plenty of ways to create web apps that do not have built in tools for signing cookies
<arubin>
kenneth: Why would you not want signed cookies?
<fivetwentysix>
kenneth: does your solution work when deploying Rails as a .war or .knob on the JVM?
hamed_r has joined #ruby
<kenneth>
it's not that signed cookies are bad, it's that trusting cookies is bad, and it if you don't trust them it doesn't matter if they're signed or not
<kenneth>
web apps should not be putting anything in the cookies other than a user id & signature
arturaz has joined #ruby
hogeo has quit [Ping timeout: 245 seconds]
<kenneth>
and if you verify the user signature on every request, you don't care if the cookie itself is signed or not
<arubin>
What?
ckrailo has joined #ruby
busybox42 has joined #ruby
workmad3 has joined #ruby
<arubin>
If you verify the signature it does not matter whether there is a signature?
stewart_ has quit [Quit: Leaving.]
<kenneth>
then, since each user's signature is (hopefully) based on a key-derivation function like pbkdf2 or (b/s)crypt, you don't have a single secret token to manage that can compromise the security of your app
vlad_starkov has quit [Remote host closed the connection]
<kenneth>
anything session-related should be stored on the server in some kind of data store, not in a cookie
<kenneth>
arubin: cookie signature != user signature
vlad_starkov has joined #ruby
slainer68 has quit [Ping timeout: 256 seconds]
vlad_starkov has quit [Remote host closed the connection]
vlad_starkov has joined #ruby
corehook has joined #ruby
chandankumar has quit [Ping timeout: 264 seconds]
<bnagy>
kenneth: how do you 'sign' this user cookie?
<kenneth>
you don't
<kenneth>
here's what you do
JohnBat26 has joined #ruby
<kenneth>
you probably have a users collection in your database. it probably contains a password field that's a pbkdf2(password)
ayaz has joined #ruby
shammancer has joined #ruby
<kenneth>
when the user logs in with a password, you set two cookies: user_id=id, user_signature=my-pbkdf2-key
vlad_sta_ has joined #ruby
<kenneth>
you never put *anything* else in cookies
hoyang has joined #ruby
rippa has quit [Ping timeout: 240 seconds]
<kenneth>
and on every subsequent request, you verify with your database that user_id and user_signature match the signatures you know
<kenneth>
if you ever need to store session information, you store it in your database
hogeo_ has quit [Remote host closed the connection]
<arubin>
Does Rails not store session information in the database?
Azulinho has quit [Ping timeout: 245 seconds]
<kenneth>
note that that's the basic principle. in practice, you;d probably want to build something that is more like user_id=id, login_timestamp=timestamp, login_signature=sha1(pbkdf2(password), login_timestamp)
<arubin>
I guess not by default.
<bnagy>
fair enough, but only works when you have a login semantic
mockra has joined #ruby
<arubin>
"Rails 2 introduced a new default session storage, CookieStore. CookieStore saves the session hash directly in a cookie on the client-side. The server retrieves the session hash from the cookie and eliminates the need for a session id."
JohnBat26 has joined #ruby
pcarrier_ has joined #ruby
<kenneth>
bnagy: sure, but you could easily do something similar without login semantics
Cultofmetatron has joined #ruby
<bnagy>
kenneth: uh I liked your first one better
<bnagy>
how?
<arubin>
"Most real-live applications choose ActiveRecord::SessionStore (or one of its derivatives) over file storage due to performance and maintenance reasons. ActiveRecord::SessionStore keeps the session id and hash in a database table and saves and retrieves the hash on every request."
bigkevmcd has joined #ruby
<bnagy>
kenneth: to trust a user cookie, you have to do something involving a secret that only you know. In your first case it's the user password
vlad_sta_ has quit [Remote host closed the connection]
<kenneth>
bnagy: have a sessions database, that have a session id, a secure-random nonce as "password", then do the same thing
<bnagy>
if you don't have a login semantic then you end up using a serverside secret
mockra has quit [Ping timeout: 248 seconds]
rippa has joined #ruby
mneorr has quit [Remote host closed the connection]
<kenneth>
sure, but you generate the secrets on the fly, store them in a database temporarily and expire them
<kenneth>
and keep the session data itself on the server
<bnagy>
how is that any different from just using a session id?
threesome has joined #ruby
<kenneth>
if you use a large-entropy secure random key as your id, it's not
<bnagy>
ok
<kenneth>
but the point is, never do you have a single server side "secure token"
<bnagy>
well they tend to have one of those anyway
<kenneth>
in a well designed system, the existence of that token is unnecessary
<bnagy>
otherwise they can't do ssl :)
<kenneth>
if the secret token brings *any* value, it's a symptom of a fundamental design flaw
dhruvasagar has joined #ruby
<bnagy>
not really
<bnagy>
it's a shitload faster
<kenneth>
thousands of rails apps on the internet can be compromised trivially because of their reliance on that "secret token"
haxrbyte has joined #ruby
<bnagy>
how is that a fundamental design flaw?
<kenneth>
considering rails is a framework that prides itself on sensible default
<bnagy>
like, if you don't keep your secret thing secret and you get hurt.. well.. duh?
<kenneth>
how is it not a fundamental design flaw to use that as your session security mechanism?
pcarrier_ has quit [Ping timeout: 248 seconds]
rippa has quit [Ping timeout: 240 seconds]
<bnagy>
it's a lot faster than doing scrypt on a DB lookup for ever request
<kenneth>
that's like if a bank issued debit card with the last four numbers of the card number as their PIN code
<bnagy>
not protecting a think that should be protected is a flaw
<kenneth>
and then blamed user stupidity for not changing their PIN numbers
<bnagy>
no, because the cookie doesn't leak the secret
<bnagy>
nb I have no idea at all about rails, never looked at it
<bnagy>
I'm just talking design
whitemage has joined #ruby
pcarrier_ has joined #ruby
<arubin>
kenneth: Did you look at the pull request? They appear to be changing it.
<kenneth>
alright, then, imagine they used the last four digits of your SSN as your PIN code
<kenneth>
not printed on the card
dik_dak has joined #ruby
<kenneth>
but much easier for somebody to compromise than having truly random PINs
jprovazn has joined #ruby
Domon has quit [Remote host closed the connection]
sleetdrop has quit [Quit: Computer has gone to sleep.]
<bnagy>
wtf?
<bnagy>
you're not making sense
<bnagy>
how is a single servside secret going to leak into the cookie, in any sane system?
<bnagy>
like, if it's stored poorly then that's an implementation issue
<kenneth>
the problem with the token is that people commit it in their repos, push it to github, give dozens of third parties access to it
<bnagy>
well those people are fucktards
<kenneth>
every developer, contractor, etc. in their organization has access to this one single point of failure token
workmad3 has quit [Ping timeout: 256 seconds]
<bnagy>
which doesn't really have anything to do with design
slainer68 has joined #ruby
<kenneth>
and you can't revoking without breaking all of your users' sessions
<kenneth>
revoke*
<bnagy>
same with your ssl cert
<bnagy>
massive things go wrong if it leaks
<bnagy>
so don't do that
<kenneth>
arubin: yeah, took a look. it's a good change
jdunck has quit [Quit: Computer has gone to sleep.]
<kenneth>
bnagy: sure, but at least your SSL certificate is typically not committed to your codebase
<bnagy>
well like I said I don't know anything about rails
lafyn has quit [Read error: Connection reset by peer]
persand has joined #ruby
<fivetwentysix>
who cares
<fivetwentysix>
lol
<fivetwentysix>
im a fuck tard
slainer68 has quit [Ping timeout: 256 seconds]
<fivetwentysix>
i have never even though about modifying the secret_token.rb file
<bnagy>
kenneth: I was mainly just vaguely interested because you were using 'signature' in a way that I found weird
<kenneth>
my entire point is simply that rails' default behavior is bad design, and that by including it as default it gives it legitimacy and renders thousands of users vulnerable
<bnagy>
so I was just poking about until I got to your point, which is fine
thomaslee has joined #ruby
thehandler has joined #ruby
<kenneth>
that being said, i don't use rails myself. precisely because of the kind of issue exemplified by this problem. i find it to be a large mess of questionable design decisions. i prefer to have much smaller and simpler libraries that i can compose together
<thehandler>
i have two web apps one on localhost:80 and localhost:8888 the one on localhost:8888 needs to do an xmlhttpreq from localhost:80, where do i need to set access control allow origin to let this happen? (the one on localhost:80 runs ruby 2.3x)
thomaslee has quit [Read error: Connection reset by peer]
JohnBat26 has joined #ruby
<bnagy>
wow ruby 2.3, sounds advanced
<bnagy>
the rest of us are on 2.0.0
filipe has joined #ruby
iMadper is now known as imadper|busy
MistuhKurtz has quit [Quit: sleeping]
<kenneth>
thehandler: CORS can be a pain. look into the rack-cors gem, it's a nice middleware that helps deal with CORS
alexmreis has joined #ruby
<thehandler>
bnagy: i gave that off the top of my head, been using ruby for a short while , sorry :0
<thehandler>
kenneth: how hard is it to install that (for a beginer?)
ckrailo has quit [Ping timeout: 260 seconds]
alexmreis has left #ruby [#ruby]
nomenkun has joined #ruby
<kenneth>
it's easy, just a gem install and a few lines in your config.ru. look at its read me on github
timonv has joined #ruby
lafyn has joined #ruby
<thehandler>
ok.
haxrbyte has quit [Remote host closed the connection]
<Hanmac>
lupine: i for sample does not dislike and do not like intellisense ... but the others need to understand that it does not work with ruby objects
sayan has quit [Read error: Connection reset by peer]
<juo100>
sometimes pursing gem source code can be a voyage of discovery, so i don't really mind going off for a hunt
<juo100>
*perusing
<zastaph>
Hanmac, it works mighty fine in Sublime Text for builting stuff like Hash
futilegames has joined #ruby
roadt_ has joined #ruby
monkegjinni has quit [Read error: Connection reset by peer]
corehook has quit [Ping timeout: 256 seconds]
<Hanmac>
hashs are different from that what you want
monkegjinni has joined #ruby
<zastaph>
so what wouldnt work for instance?
gyre007 has joined #ruby
skattyadz has quit [Quit: skattyadz]
danslo has joined #ruby
<zastaph>
File. also gives me a correct popup
<lupine>
Hanmac, it can work, a bit, most of the time
<lupine>
but it's the kind of thing that, if it doesn't work perfectly all the time, is extremely annoying
<lupine>
intellisense was, on balance, a net win in delphi
roadt has quit [Ping timeout: 256 seconds]
<zastaph>
its all a dream about not having to leave your editor while programming :)
vlad_sta_ has joined #ruby
<lupine>
my editor is gedit, and it shares screen acreage with browser and terminal
<lupine>
context switches are very cheap as a result
Matip has quit [Ping timeout: 264 seconds]
fivetwentysix has quit [Quit: fivetwentysix]
<lupine>
I've considered adding multi-pointer X and having a right-side mouse for keyboard ^^
Shrink has joined #ruby
Shrink has joined #ruby
olleromo has joined #ruby
<zastaph>
i have a feeling it's only a setting to make it work with gems too.. because SublimeCodeIntel isn't built for Ruby, it works for many other languages too by simply spawning the ruby interpreter
<zastaph>
it just needs to be told somehow where to look
danslo has quit [Ping timeout: 245 seconds]
freeayu__ has joined #ruby
Domon has quit [Remote host closed the connection]
vlad_starkov has quit [Ping timeout: 256 seconds]
Xeago_ has joined #ruby
Leighton has quit [Quit: Leaving]
Cork has quit [Read error: Operation timed out]
baba has quit [Quit: WeeChat 0.4.0]
freeayu has quit [Ping timeout: 276 seconds]
xiella has quit [Ping timeout: 248 seconds]
mercwithamouth has joined #ruby
persand has joined #ruby
Domon has joined #ruby
ntus1017 has quit [Remote host closed the connection]
huoxito has joined #ruby
fermion has joined #ruby
maetthew has joined #ruby
ejnahc has quit [Quit: leaving]
ejnahc has joined #ruby
labs-0x99 has quit [Quit: Leaving]
Domon has quit [Remote host closed the connection]
<joshu>
I'm not really sure what I'm doing if someone could please look over my code
geekbri has joined #ruby
<halfie>
how does "gem query --remote" works? it seems to show a listing of all (???) gems.
nomenkun has joined #ruby
ejnahc has joined #ruby
vlad_starkov has joined #ruby
krz has quit [Quit: krz]
yshh has joined #ruby
devoldmx3 has joined #ruby
tshauck has quit [Ping timeout: 264 seconds]
<halfie>
Morrolan, "GET /latest_specs.4.8.gz HTTP/1.1" <== seems to be the key
kirun has joined #ruby
tundrax has joined #ruby
devoldmx has quit [Ping timeout: 256 seconds]
sambao21 has joined #ruby
<Morrolan>
halfie: Heh, nice.
vlad_sta_ has quit [Ping timeout: 260 seconds]
nari has joined #ruby
monkegjinni has quit [Read error: Connection reset by peer]
guiocavalcanti has quit [Remote host closed the connection]
tundrax has quit [Remote host closed the connection]
_nitti has joined #ruby
monkegjinni has joined #ruby
mardar has quit [Ping timeout: 252 seconds]
mardar has joined #ruby
jcromartie has joined #ruby
nezumi has quit [Ping timeout: 245 seconds]
breadthfirst has joined #ruby
niceguyjames has joined #ruby
monkegjinni has quit [Read error: Connection reset by peer]
ebouchut has quit [Quit: This computer has gone to sleep]
tk_ has joined #ruby
_nitti has quit [Remote host closed the connection]
monkegjinni has joined #ruby
jnoob22 has quit [Remote host closed the connection]
jnoob22 has joined #ruby
_nitti has joined #ruby
ctp has quit [Quit: Leaving...]
<joshu>
any ideas why I'm getting that initialised error
niklasb has joined #ruby
guiocavalcanti has joined #ruby
breadthfirst has quit [Remote host closed the connection]
Neomex has joined #ruby
welandC has quit []
famulus has quit [Quit: Ex-Chat]
<Morrolan>
Did you 'require' whatever file this class is in?
monkegjinni has quit [Read error: Connection reset by peer]
_nitti has quit [Ping timeout: 248 seconds]
sambao21 has quit [Quit: Computer has gone to sleep.]
<joshu>
Morrolan I think so
monkegjinni has joined #ruby
<ramblex>
joshu: don't you need to require 'ffm' in ffm_test.rb ?
devoldmx3 has quit [Ping timeout: 276 seconds]
<joshu>
ramblex let me try
<Morrolan>
Might want to add an explicit "require 'foo'" at the top of the file where the error happens. If it works afterwards, then you probably didn't require it.
<joshu>
Morrolan ok going to test now
jacobbednarz has quit [Quit: Laters.]
breadthfirst has joined #ruby
emergion has quit [Quit: Computer has gone to sleep.]
T|ASK has joined #ruby
corehook has joined #ruby
monkegjinni has quit [Read error: Connection reset by peer]
monkegjinni has joined #ruby
ananthakumaran has joined #ruby
ephemerian has quit [Quit: Leaving.]
philcrissman has joined #ruby
awojo has joined #ruby
roadt_ has quit [Ping timeout: 256 seconds]
devoldmx has joined #ruby
ananthakumaran1 has quit [Ping timeout: 276 seconds]
Shrink has quit [Read error: Connection reset by peer]
Shrink has joined #ruby
Shrink has quit [Changing host]
Shrink has joined #ruby
eka has joined #ruby
<joshu>
ramblex Morrolan thank you both I added it and that error disappeared. Now I'm getting an error about reading the file :(
monkegjinni has quit [Read error: Connection reset by peer]
danslo has joined #ruby
kiri has quit [Ping timeout: 256 seconds]
DrHeiter23 has quit [Quit: DrHeiter23]
speakingcode has quit [Ping timeout: 252 seconds]
monkegjinni has joined #ruby
<joshu>
I had to comment # FFM.new(STDIN) in ffm.rb to make it work. Not sure if I've structured this script correctly
devoldmx has quit [Ping timeout: 276 seconds]
speakingcode has joined #ruby
guiocavalcanti has quit [Read error: Connection reset by peer]
ntus1017 has quit [Remote host closed the connection]
<joshu>
if I have ENV['RACK_ENV'] = 'test' in my test_helper.rb doesn't that mean that if I do puts ['RACK_ENV'] in my main ruby file that it should be set to test?
emergion has joined #ruby
juo100 has joined #ruby
moos3 has quit [Quit: Computer has gone to sleep.]
maverick9 has quit [Quit: Leaving]
emergion has quit [Client Quit]
<waxjar>
if you require test_helper in your "main ruby file" (it should say puts ENV['RACK_ENV'] of course ;) )
<Xeago>
what is the analytics tool called that you can configure to include google analytics, gaug.es and more?
mklappstuhl has joined #ruby
haxrbyte_ has joined #ruby
splittingred has joined #ruby
haxrbyte has quit [Read error: Connection reset by peer]
alexgordon has joined #ruby
<joshu>
waxjar this is what I have in my main rb file initialise method @mail = ['RACK_ENV'] == 'test' ? Mail.new(File.read(stdin)) : Mail.new(STDIN.read)
rickruby has joined #ruby
rickruby has quit [Remote host closed the connection]
<waxjar>
['RACK_ENV'] is just an array with a string in it.
sambao21 has joined #ruby
dustint has joined #ruby
tundrax has joined #ruby
moos3 has joined #ruby
tommyvyo has quit [Quit:]
<waxjar>
so that will always evaluate to false
monkegjinni has quit [Read error: Connection reset by peer]
kil0byte has joined #ruby
wallerdev has joined #ruby
monkegjinni has joined #ruby
Xeago_ has quit [Ping timeout: 250 seconds]
jroes has left #ruby [#ruby]
<joshu>
waxjar but when I run rake test and I have a "puts ['RACK_ENV'] in my main file initialise method it just show RACK_ENV in the console not "test"
ctp has quit [Quit: Leaving...]
<Dwarf>
Afternoon, I'm trying to implement simple version checking, how would I go on about comparing 2.2.0-alpha.1 to 2.2.0-alpha.2 with eachother? Currently if I compare 2.2.0-alpha.2 with itself (x < y) it returns true
Spami has joined #ruby
Spami has quit [Changing host]
Spami has joined #ruby
<waxjar>
you need ENV['RACK_ENV'], like I said, ['RACK_ENV'] is just an Array with the item 'RACK_ENV' in it, it will never be equal to "test".
<joshu>
waxjar sorry I missed that I understand now! ;)
mklappstuhl has quit [Ping timeout: 252 seconds]
girija has quit [Read error: Connection reset by peer]
a_a_g_0 has quit [Read error: Connection reset by peer]
dangerousdave has quit [Read error: Connection reset by peer]
wallerdev has quit [Quit: wallerdev]
corehook has joined #ruby
rickruby has quit [Ping timeout: 248 seconds]
Animawish has quit [Quit: Animawish]
ferdev has joined #ruby
joast has quit [Quit: Leaving.]
<ramblex>
joshu: it is defined in parse isn't it?
_veer has joined #ruby
_veer has joined #ruby
_veer has quit [Changing host]
Spami has joined #ruby
Spami has quit [Changing host]
Spami has joined #ruby
<joshu>
ramblex but before the parse method is written won't the test return a NoMethodError?
<waxjar>
hah, is that from They Live Hanmac?
davetherat has quit [Ping timeout: 248 seconds]
jtharris has joined #ruby
<joshu>
I'm trying to write my own test like this: assert_equal "X-FFM: ignore", @mail.header['X-FFM'] but I get a NoMethodError when I run the test for "header" which is part of the mail gem. It doesn't help if I require the mail gem in the test file
<ramblex>
yeh, the article's about TDD, writing the tests first, then writing just enough code to make the test pass
tommyvyo has joined #ruby
<joshu>
ramblex I'm trying to learn from it and do the same but my first test maybe I'm writing it wrong
<Hanmac>
waxjar: yeah you are right
tockitj has joined #ruby
<waxjar>
hehe, nice
<joshu>
I setup a fixture which is an email message on disk. It reads it fine. I want to write a method which will check for a specific header and if it's present do something else. I can write that code like this
monkegjinni has quit [Read error: Connection reset by peer]
<joshu>
if @mail.header['X-FFM'].to_s == "ignore"
<joshu>
# $stderr.puts "This email has already been processed"
skattyadz has quit [Quit: skattyadz]
altamic has joined #ruby
<joshu>
but if I want to start with the test wouldn't I write something like assert_equal "X-FFM: ignore", @mail.header['X-FFM']
girija has quit [Read error: Connection timed out]
baordog has joined #ruby
<baordog>
Morning
_KGBot_ has joined #ruby
girija has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
kaliosas has joined #ruby
<baordog>
I have a question: How do I send a variable into a function parameter? I.e I have Time.new(year,month,day), and I want to specify those in variables like @year
roadt_ has joined #ruby
* kaliosas
b.uy cs, nfs,cod,nba and other steam acc/gifts. /q me
osvico has quit [Ping timeout: 256 seconds]
tomku has joined #ruby
Spami has quit [Quit: This computer has gone to sleep]
Xeago has quit [Remote host closed the connection]
Spami has joined #ruby
Spami has quit [Changing host]
Spami has joined #ruby
monkegji_ has quit [Read error: Connection reset by peer]
gaahrdner has joined #ruby
monkegjinni has joined #ruby
<halfie>
rambler, awesome, thanks!
Davey has joined #ruby
* kaliosas
b.uy cs, nfs, cod, dirt, nba and other steam acc/gifts. /q me
kaliosas has quit [Killed (idoru (Spam is off topic on freenode.))]
pipework has joined #ruby
io_syl has quit [Quit: Computer has gone to sleep.]
falood has quit [Remote host closed the connection]
a_a_g_0 has quit [Quit: Leaving]
Iszak has joined #ruby
Iszak has quit [Max SendQ exceeded]
workmad3 has joined #ruby
Iszak has joined #ruby
Iszak has quit [Max SendQ exceeded]
Akuma has quit [Quit: So long sukkas!]
r0bglees0n has joined #ruby
monkegjinni has quit [Remote host closed the connection]
backjlack has quit [Remote host closed the connection]
monkegjinni has joined #ruby
YuryBatenko has joined #ruby
momomomomo has joined #ruby
monkegjinni has quit [Read error: Connection reset by peer]
<pagios>
hello i would like to throw a script into the background attached to a certain tty like pts/1, when i include the script in /etc/rc.local it is getting assign to console "?" how can i attach it to a specific terminal in bg? thanks
monkegjinni has quit [Remote host closed the connection]
Cultofmetatron has joined #ruby
<pagios>
dr_bob: how?
momomomomo has quit [Quit: momomomomo]
olleromo has quit [Ping timeout: 260 seconds]
wolcanus has joined #ruby
shevy has quit [Remote host closed the connection]
blandflakes has joined #ruby
nomenkun has quit [Ping timeout: 256 seconds]
<pagios>
dr_bob: ENV['EDITOR'] = 'gedit' ?
<pagios>
is that the way to export an env variable in ruby>?
ckrailo has joined #ruby
Cultofmetatron has quit [Read error: Connection reset by peer]
Kricir has joined #ruby
<greenarrow>
how do i get the load file of a file which has been read in using tempfile
<greenarrow>
load time*
<waxjar>
pagios, yeah
PragCypher has joined #ruby
<waxjar>
if you need to set a lot of them, have a look at .env
<waxjar>
*dotenv
<apeiros>
Hanmac: omg
sambao21 has quit [Quit: Computer has gone to sleep.]
daniel_hinojosa has joined #ruby
monkegjinni has joined #ruby
robbyoconnor has quit [Ping timeout: 248 seconds]
<Hanmac>
i am suprised that COBOL still exist
Spami has joined #ruby
Spami has quit [Changing host]
Spami has joined #ruby
ariedler has joined #ruby
kpshek has quit []
io_syl has joined #ruby
grobb has quit [Read error: Connection timed out]
grobb has joined #ruby
<pagios>
ok i am running into this problem, i have a ruby script that is using sinatra, and on channel call "/start" for example, a system level command is executed, now all works fine if i do it from the shell, i am triyng to run it at boot time and this system command needs environmental variables to run, i am trying to set them through ruby using ENV['env1]='...' but still the command fails because of not seeing the env variables, what am i missing
jnoob22_ has quit [Remote host closed the connection]
tundrax has quit [Remote host closed the connection]
mklappstuhl has joined #ruby
jnoob22 has joined #ruby
zeeraw has joined #ruby
<joshu>
anyone know how to write mini tests specifically with the mail gem? I'm not getting anywhere on my own :(
Ontolog has joined #ruby
kil0byte has quit [Remote host closed the connection]
sleetdrop has joined #ruby
arturaz has quit [Ping timeout: 276 seconds]
<Morrolan>
joshu: Put the code and potential error messages on gist.github.com and throw the link in here. :)
dhruvasagar has quit [Read error: Operation timed out]
pskosinski has quit [Remote host closed the connection]
wsterling has joined #ruby
tjbiddle has joined #ruby
nedbat has joined #ruby
pskosinski has joined #ruby
<nedbat>
I'm using sh() in a Rakefile to get some data before performing other operations. I'd like this sh() line not to echo to the terminal. Is there a way to suppress that?
arya has quit [Ping timeout: 248 seconds]
mityaz has joined #ruby
bradhe has joined #ruby
dhruvasagar has joined #ruby
tk_ has quit [Quit: ばいばい]
rismoney has joined #ruby
robottinosino has quit [Ping timeout: 256 seconds]
carlyle has joined #ruby
jdunck has joined #ruby
threesome has quit [Ping timeout: 248 seconds]
davetherat has joined #ruby
bradhe has quit [Remote host closed the connection]
sayan has quit [Read error: Connection reset by peer]
<Morrolan>
joshu: One thing which is probably not going to work is the "require 'FFM'". At the very least it should be lowercase, since the file's name is lowercase.
<Morrolan>
(Though I am not sure how it works with case-insensitive file systems.)
bradhe has joined #ruby
jmsbrwr has quit [Quit: Leaving]
rakl has joined #ruby
<Morrolan>
joshu: Apart from that your test will depend on what you expect FFM#parse to do. Should it return the header? Should it raise an exception? Should it run around in circles?
blaxter has quit [Ping timeout: 245 seconds]
rakl has quit [Max SendQ exceeded]
dhruvasagar has quit [Ping timeout: 248 seconds]
buibex has quit [Remote host closed the connection]
rakl has joined #ruby
vlad_starkov has quit [Ping timeout: 256 seconds]
<joshu>
Morrolan ok I changed the require thanks for spotting.
<joshu>
Morrolan I'm trying to test if a specific header is present
Glacer232 has joined #ruby
Glacer232 has quit [Max SendQ exceeded]
<joshu>
I'm running around in circles :(
Glacer232 has joined #ruby
Glacer232 has quit [Max SendQ exceeded]
arietis has joined #ruby
<Morrolan>
So the parse() function should check if a specific header is present, you say?
<Morrolan>
What should it do if the header is present? What should it do if it is not present?
devoldmx has quit [Ping timeout: 256 seconds]
<joshu>
Yes as a start anyway. If it is present it should exit the script and not continue. If it is present it should continue
Glacer232 has joined #ruby
ciscoswitch has joined #ruby
devoldmx has joined #ruby
<joshu>
I can write the code which works. But I'd like to learn how to write a test and then the code.
<Morrolan>
Will the parse function merely return whether the header is present, or will, if it is present, it set some instance variables, read from a file. print to the console, or what exactly?
<geggam>
ty joshu ... i just paid for that book... it was what i was looking for
<joshu>
Right if the header is present exit the script exit(1) $stderr.puts "This email has already been processed". If not present get the to and from addresses.
<joshu>
geggam no worries ;)
cj3kim has joined #ruby
altamic has quit [Quit: altamic]
alexmreis has joined #ruby
<joshu>
nedbat I've just browsed it so not sure
jlast has quit [Remote host closed the connection]
cj3kim has quit [Remote host closed the connection]
<joshu>
Morrolan does that make sense?
<Morrolan>
In this case you will want to test that, when the header is not present, it prints to stderr, for example. Minitest has an assertion called assert_output which you could use to do that.
Dummies_freelanc has quit [Ping timeout: 256 seconds]
markalanevans has joined #ruby
jlast has joined #ruby
robottinosino has joined #ruby
<Morrolan>
Now as for the case where the header is present. Once it extracted the to and from addresses, what does it do with those? Does it return them? Does it print them somewhere?
<Morrolan>
Err, I switched up the header present / header not present situation.
wolcanus has quit [Remote host closed the connection]
cpruitt_ has joined #ruby
filipe_ has quit [Remote host closed the connection]
hongoBlow has joined #ruby
cpruitt_ has quit [Read error: Connection reset by peer]
buibex has joined #ruby
buibex has quit [Remote host closed the connection]
cpruitt_ has joined #ruby
<hongoBlow>
hello
sambao21 has joined #ruby
JMcAfreak has joined #ruby
cpruitt has quit [Ping timeout: 248 seconds]
cpruitt_ is now known as cpruitt
sambao21 has quit [Client Quit]
<joshu>
Morrolan ok. But how do I get my test to check for the header? When I write assert_equal "X-FFM: ignore", @mail.header['X-FFM']
morgajel has joined #ruby
ffranz has quit [Quit: Leaving]
johnrlive has joined #ruby
<Morrolan>
You don't check the header. You check the parse function.
Neomex has quit [Ping timeout: 240 seconds]
<Morrolan>
First manually create a mail *with* the header and pass it to this FFM object, then call its parse() function. Then you assert that it does print to stderr with your desired output.
guardadigital_ has joined #ruby
mikepack has joined #ruby
zeeraw has quit [Quit: Computer has gone to sleep.]
<Morrolan>
Then you manually create a mail without the header and do the same procedure again. Just that, this time, you assert that, instead of printing to stderr, it does whatever it's supposed to do.
eykosiou_ has joined #ruby
blaxter has joined #ruby
`brendan has joined #ruby
<Morrolan>
A unit test works by 1) you manually creating inputs to functions 2) you calling the function 3) you checking that the the function does what it's supposed to do.
<joshu>
ok so my fixture as I've learnt is just the email saved to disk with the header present.
hongoBlow has left #ruby [#ruby]
sambao21 has joined #ruby
chrishough has joined #ruby
suporte85 has quit [Ping timeout: 256 seconds]
rakl has quit [Quit: sleeping]
uncleBob_ has quit [Remote host closed the connection]
ffranz has joined #ruby
browndawg has quit [Quit: Leaving.]
eykosioux has quit [Ping timeout: 248 seconds]
<joshu>
So my first test should be like this assert_output "This email has already been processed"
johnrlive has quit [Remote host closed the connection]
tjbiddle has quit [Quit: tjbiddle]
Spami_ has joined #ruby
arya has joined #ruby
rads has joined #ruby
joonty has quit [Quit: leaving]
<Morrolan>
Read the email from the file, pass it to the FFM object, call parse, make sure that it outputs the error message, yes.
tylersmith has joined #ruby
bradhe has quit [Remote host closed the connection]
akells` has quit [Remote host closed the connection]
<Morrolan>
You might want to revamp the way which FFM#initialize works, by the way. It is, hmm, slightly confusing. Simply make its one argument be a string, which it then stores in an instance variable, instead of having it either take a string or a path to a file depending on the environment.
Spami has quit [Ping timeout: 264 seconds]
thehandler has quit [Ping timeout: 264 seconds]
bradhe has joined #ruby
arietis has quit [Quit: Computer has gone to sleep.]
<joshu>
Morrolan I had just @mail = Mail.new(STDIN.read), but when I tried testing with a file I kept getting errors as there was nothing on STDIN so that's why I wrote that conditional. I don't know how else to do it except for comment and uncomment a separate line such as @mail = Mail.new(File.read(path))
saarinen has joined #ruby
<joshu>
that's why I had to put this at the end of the file too if __FILE__ == $PROGRAM_NAME
<joshu>
FFM.new(STDIN)
<joshu>
end
saarinen has quit [Client Quit]
<joshu>
or else mintiest would throw an error
<Morrolan>
Don't make FFM read from stdin directly. Make it take a string as an argument, for example.
<Morrolan>
I can't really advise you on that without knowing what 'FFM' is, or how it'll be part of your software.
robbyoconnor has joined #ruby
eldariof has joined #ruby
<joshu>
I will be happy to explain more.
Cultofmetatron has joined #ruby
bradhe has quit [Ping timeout: 252 seconds]
<joshu>
FFM is "simply" a ruby script which will receive email on STDIN via postfix pipe. FFM is going to be used to parse 4 specific types of emails.
zeeraw has joined #ruby
sailias has quit [Quit: Leaving.]
sambao21 has quit [Quit: Computer has gone to sleep.]
dhruvasagar has joined #ruby
mahmoudimus has joined #ruby
sambao21 has joined #ruby
noname001 has quit [Remote host closed the connection]
jlast has quit [Remote host closed the connection]
<Morrolan>
I'll be leaving soon, got a fest to attend to. At any rate you might want to have the FFM class' constructor take a string as its argument, and simply have code in the script (outside the class) which a) reads from stdin b) creates a new FFM object and passes it the email which it read from stdin.
monkegjinni has quit [Remote host closed the connection]
devoldmx has quit [Ping timeout: 256 seconds]
moted has joined #ruby
saarinen has joined #ruby
robottinosino has quit [Ping timeout: 264 seconds]
rubynobe has joined #ruby
AlSquire has quit [Quit: Quitte]
jerius has quit [Ping timeout: 245 seconds]
browndawg has joined #ruby
monkegjinni has joined #ruby
jerius_ is now known as jerius
devoldmx has joined #ruby
<rubynobe>
I just started learning ruby
xcv_ has joined #ruby
<rubynobe>
I know how to class basic classes what is the next step guys
vlad_starkov has joined #ruby
alvaro_o has joined #ruby
alvaro_o has quit [Client Quit]
blacktulip has joined #ruby
<rubynobe>
make*
insel has quit [Ping timeout: 264 seconds]
<bean__>
rubynobe: i'd go through a good ruby tutorial online, rubymonk, etc.
<rubynobe>
bean__: i did the basics i wanna move forward
<bean__>
Then start building something :)
devoldmx3 has quit [Ping timeout: 264 seconds]
monkegjinni has quit [Remote host closed the connection]
<rubynobe>
bean__: what should i build at work we do rails i wanna do something in ruby
chandankumar has quit [Remote host closed the connection]
Kar- has joined #ruby
xcv has quit [Read error: Connection reset by peer]
AlSquire has joined #ruby
kn0tsel has joined #ruby
<rubynobe>
anyone
blacktul_ has quit [Ping timeout: 276 seconds]
<havenwood>
rubynobe: What about a some code katas? Have you done ruby-koans, ruby-warrior, ruby-mmo, project-euler, etc?
BonSequitur has joined #ruby
<nedbat>
rubynobe: make a madlibs game
ChrisBolton has quit [Quit: chrisbolton]
<jeebster>
rubynobe: build me a stock exchange analayzer
dhruvasagar has joined #ruby
<rubynobe>
havenwood: no I did not know about this stuff
johnkary has joined #ruby
<havenwood>
rubynobe: Project Euler proposes mathematical problems that can be solved with the help of a programming language: http://projecteuler.net/problems
jonathanwallace has joined #ruby
tesuki_ has quit [Remote host closed the connection]
daniel_- has joined #ruby
<nedbat>
rubynobe: project euler problems are often more about math than about programming
<rubynobe>
jeebster: lol... I 'm just started ruby I am not sure if i can build a real life project as yet
<jeebster>
rubynobe: just build some basic i/o app then
Neomex has joined #ruby
<rubynobe>
jeebster: what you mean i/o app
<havenwood>
rubynobe: ruby-warrior is fun and starts out beginner level
<rubynobe>
havenwood: thank you
monkegjinni has joined #ruby
<havenwood>
rubynobe: #gets and #puts are IO (in and out)
<jeebster>
rubynobe: take user input, output something
baroquebobcat has joined #ruby
ciscoswitch has left #ruby [#ruby]
kf8a has joined #ruby
<rubynobe>
jeebster: I have been doing that for past 1 month
arietis has joined #ruby
girija has joined #ruby
<havenwood>
rubynobe: IO can be lots of things, long as they go in and out. :P You can look at the Ruby IO class in the standard library for some info! http://ruby-doc.org/core-2.0/IO.html
spider-mario has joined #ruby
<jeebster>
rubynobe: analyze audio files. I dunno
<jeebster>
the possibilities are endless
ebouchut has quit [Quit: This computer has gone to sleep]
<jeebster>
not sure why you asked otherwise
druonysus has joined #ruby
druonysus has quit [Changing host]
druonysus has joined #ruby
slash_nick has quit [Ping timeout: 248 seconds]
moted has quit [Ping timeout: 252 seconds]
rubynobe has quit [Quit: Page closed]
robottinosino has joined #ruby
jonathanwallace has quit [Ping timeout: 252 seconds]
buibex has quit [Remote host closed the connection]
bluOxigen has quit [Ping timeout: 260 seconds]
bluOxigen has joined #ruby
<nedbat>
the docs for Dir.entries doesn't mention what order the file names are in. Is it sorted or not?
jp___ has joined #ruby
xcv_ has quit [Remote host closed the connection]
<ericwood>
sorted by what?
<jjasonclark>
hey all. anyone know what the configure option is for 1.9.3-p429 to use threads? is it --enable-threads=posix or does --disable-pthread do it?
<ericwood>
nedbat: I think it's safe to assume it isn't sorted and sort by whatever you'd like!
vlad_sta_ has joined #ruby
<nedbat>
ericwood: it's certainly safe to sort them! I just expected a statement one way or the other.
jonathanwallace has joined #ruby
<jjasonclark>
@nedbat I wold guess that it is sorted by the filesystem table. what ever is that order
<havenwood>
nedbat: I believe in the order returned by the filesystem.
<baordog>
I'm assuming the @pressure variable is not being routed to it
ananthakumaran has joined #ruby
chandankumar has joined #ruby
<havenwood>
baordog: You do refer to the instance variable @pressure and then later to the class variable @@pressure. I haven't actually looked closely at the code but I wonder if that discrepancy is related?
<atmosx>
nedbat: test it and let us know.
Kricir has joined #ruby
<atmosx>
nedbat: yes they are srted, first hidden then regular by alphabetical order
<nedbat>
shevy: no, only if you want people to think well of you.
<shevy>
nedbat: I want you to like me
sambao21 has joined #ruby
<otters>
havenwood: not enough information for me
<otters>
that doesn't feel nice
girija has quit [Remote host closed the connection]
<Hanmac>
shevy join #openrubyrmk ... it has a mailing list now ;P
<havenwood>
otters: Exclusionary report card is exclusionary.
<shevy>
Hanmac: hmm ok... I am on chatzilla right now, and my firefox has problems with flash videos, which I watch, so in case I suddenly go off again, it is because firefox crashed again
<csaunders>
has anyone been working on some minitest 5.0 plugins?
<csaunders>
I'm trying to get the minitest-reporters to work with 5.0 but it seems like the plugin_XXX_init functions aren't being called. Was wondering if anyone has experienced a similar issue
tesuki has joined #ruby
interactionjaxsn has quit [Ping timeout: 252 seconds]
predator217 has quit [Ping timeout: 248 seconds]
interactionjaxsn has joined #ruby
matti has quit [Quit: Oh dear...]
bklane has quit [Remote host closed the connection]
timonv has joined #ruby
thomasle_ has joined #ruby
mklappstuhl has quit [Remote host closed the connection]
hamush has joined #ruby
saarinen has joined #ruby
mklappstuhl has joined #ruby
rads has quit [Quit: rads]
<hamush>
hi, i'm trying to install rdoc stuff, but "gem rdoc --all" keeps on giving me errors on individual gems and quitting. is there a way to have it continue even after its encountered an error with a gem?
skattyadz has quit [Quit: skattyadz]
jdunck has joined #ruby
skattyadz has joined #ruby
chrishough has quit [Quit: chrishough]
carlyle has quit [Remote host closed the connection]
cpruitt has quit [Quit: cpruitt]
carlyle has joined #ruby
nik_-_ has joined #ruby
predator117 has joined #ruby
kn0tsel has quit [Remote host closed the connection]
c0rn has joined #ruby
mklappstuhl has quit [Ping timeout: 256 seconds]
Darlal has quit [Quit: Textual IRC Client]
chrishough has joined #ruby
YuryBatenko has quit [Quit: Computer has gone to sleep.]
kn0tsel has joined #ruby
matti has joined #ruby
rads has joined #ruby
kn0tsel has quit [Remote host closed the connection]
JimmyNeutron has joined #ruby
cpruitt has joined #ruby
Aristata has joined #ruby
stkowski has quit [Quit: stkowski]
mklappstuhl has joined #ruby
<Aristata>
How would I write a block method that captures a variables state, changes state to false then does somening then reverts the state back
mklappstuhl has quit [Remote host closed the connection]
mklappstuhl has joined #ruby
Zoup has joined #ruby
<nightfly>
do exactly that?
hamush has quit [Quit: WeeChat 0.3.8]
<Zoup>
using mutex and monitor .synchronize when using .create (activerecord), but all threads are sleeping now, any ideas?
breadthfirst has quit [Remote host closed the connection]
motto has quit [Read error: Connection reset by peer]
csaunders has quit [Quit: Computer has gone to sleep.]
syko has quit [Remote host closed the connection]
axl_ has quit [Quit: axl_]
chandankumar has joined #ruby
mockra has joined #ruby
l33 has quit [Read error: Connection reset by peer]
<havenwood>
Err, 2007... that isn't new at all. Just not as I recalled. >.>
fermion has quit [Client Quit]
l33 has joined #ruby
jdunck has quit [Quit: Computer has gone to sleep.]
nanothief_ has quit [Ping timeout: 240 seconds]
mark_locklear has quit [Ping timeout: 256 seconds]
s0ber has quit [Read error: Connection reset by peer]
Criztian has quit [Remote host closed the connection]
saarinen has quit [Quit: saarinen]
<havenwood>
terrellt: Lazy loading an array? What would that look like?
Davey has quit [Ping timeout: 260 seconds]
<terrellt>
havenwood: I was hoping for a shortcut for something I realized I don't have a shortcut for. Essentially I need a wrapper that only starts instantiating objects when those objects are asked for.
mityaz has quit [Quit: See ya!]
<terrellt>
havenwood: I think I'm just gonna write it. Thank you, and apeiros too.
<havenwood>
ActualPerson: %w[can you tell us is].shuffle.join ' '
<ActualPerson>
by the etext
<ActualPerson>
havenwood: the gate opened, and found morrel seated at a table, and the more music there was, above all things ; and i can.
Xeago_ has joined #ruby
Davey has joined #ruby
johnrlive has quit [Remote host closed the connection]
saragojo has joined #ruby
saragojo has quit [Remote host closed the connection]
ActualPerson was kicked from #ruby by apeiros [spam is not tolerated]
saragojo has joined #ruby
ebouchut has quit [Quit: This computer has gone to sleep]
jkline has joined #ruby
<havenwood>
joshu: I'd suggest using the #warn method instead of explicitly doing $stderr.puts.
<jkline>
hi
bluOxigen has quit [Ping timeout: 246 seconds]
<havenwood>
hi
Xeago has quit [Ping timeout: 264 seconds]
<havenwood>
joshu: Might consider a case statement instead of if statement for mail_type.
<joshu>
havenwood ok will change. Also planning on logging to a log file.
centr0 has quit [Quit: centr0]
DanBurton has joined #ruby
nettoweb has joined #ruby
saragojo has quit [Client Quit]
megha has quit [Quit: WeeChat 0.4.0]
carlyle has quit [Remote host closed the connection]
Xeago_ is now known as Xeago
ruby has joined #ruby
ruby has quit [Remote host closed the connection]
<joshu>
havenwood can you please explain why warn is preferred over $stderr
<DanBurton>
Hey guys. Suppose I want to write "class Foo; attr_accessor :foo, :bar, :baz; end". Is there a way to create a Foo like so: "Foo.new foo: 'f', bar: 'b', baz: 'b'", which does the obvious thing, without having to hand-code the boilerplatey initialize method?
<havenwood>
joshu: Seems a bit odd for the "Send" and "Sent" to be strings. I'd have expected symbols or a boolean variable.
ruby has joined #ruby
breadthfirst has quit [Remote host closed the connection]
Criztian has joined #ruby
decentrality has joined #ruby
fmcgeough has quit [Quit: fmcgeough]
emmanuelux has quit [Ping timeout: 256 seconds]
saarinen has joined #ruby
Cultofme_ has quit [Read error: Connection reset by peer]
Cultofmetatron has joined #ruby
Criztian has quit [Remote host closed the connection]
nricciar has quit [Remote host closed the connection]
tesuki has quit [Read error: Connection reset by peer]
tesuki has joined #ruby
<havenwood>
joshu: Makes it clear what you mean to do. #abort or #warn are nice helper methods for the standard use-case
<joshu>
havenwood ok I understand. I've rewritten the process_mail method using a case statement as you suggested for mail_type
<havenwood>
joshu: (#abort also does an exit with an error status after puts'n to stderr.
<havenwood>
)
machuga is now known as machuga|away
devoldmx has joined #ruby
codecop has quit [Quit: Išeinu]
<joshu>
havenwood cool so I changed another $stderr.puts and then exit(1) to warn("something") abort
<joshu>
cleaner to read and understand
jkline has quit [Ping timeout: 260 seconds]
[[thufir]] has quit [Read error: Operation timed out]
Al___ has joined #ruby
kpshek has quit []
jkline has joined #ruby
ruby has quit [Remote host closed the connection]
ruby has joined #ruby
<joshu>
havenwood I'm not sure on what you meant with "I'd have expected symbols or a boolean variable." I agree my code in mail_type method 'Send' if @from_domain == ENV['DOMAIN'] && @to_domain == ENV['FAX_DOMAIN'] is odd
breadthfirst has joined #ruby
generalissimo has quit [Remote host closed the connection]
devoldmx3 has quit [Ping timeout: 260 seconds]
spider-mario has quit [Read error: Connection reset by peer]
sayan has quit [Read error: Connection reset by peer]
<Raydiation>
woops, wanted rails :)
lkba has joined #ruby
<havenwood>
Hiroshi san maintains a great list of Ruby HTTP Clients: goo.gl/PyvFG
<havenwood>
err, mt
carloslopes has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 264 seconds]
<waxjar>
you can put the calls to warn on the same line joshu: when :x then warn(…)
emmanuelux has joined #ruby
<havenwood>
joshu: Maybe use instance variables for @send, @sent, etc?
sambao21 has joined #ruby
Davey has quit [Ping timeout: 256 seconds]
Raydiation has left #ruby [#ruby]
<joshu>
waxjar ok I'm going to add method calls for each case, e.g. when :send fax_send. SHould I still put it on the same line?
<havenwood>
joshu: Typically, with #puts and #warn one doesn't use parens - but it is valid to do so.
kpshek has joined #ruby
nomenkun has joined #ruby
<joshu>
havenwood so warn "fax_send" ?
<havenwood>
joshu: yup
<waxjar>
joshu, you don't have to, but you can. it's easier on the eye imo
<joshu>
waxjar cool
<joshu>
havenwood sorry you lost me with instance variables @send etc
Davey has joined #ruby
<joshu>
havenwood where would I use them if I'm using symbols?
Guedes0 has joined #ruby
<havenwood>
joshu: I dunno what the rest of your class looks like, but I'd imagine something like setting the ivars inside `def initialize` to something like: @sent = false
tesuki has quit [Remote host closed the connection]
mrsolo has quit [Quit: This computer has gone to sleep]
<joshu>
havenwood I see. I will finish off the rest of the script and then I will ask you guys for some feedback please ;)
mrsolo has joined #ruby
sambao21 has quit [Ping timeout: 256 seconds]
nomenkun has quit [Ping timeout: 240 seconds]
ruby has quit [Remote host closed the connection]
ruby has joined #ruby
<havenwood>
joshu: Instead of #warn(something); #abort you can do #abort(something), as well.
mrsolo has quit [Client Quit]
<havenwood>
(Message and exit with fail status in one.)
saarinen has quit [Quit: saarinen]
<becom33>
is there a function to detect current user in php except system('whoami')
<joshu>
havenwood awesome :D
theRoUS has quit [Ping timeout: 276 seconds]
Proshot has joined #ruby
Lubinski has quit [Read error: Connection reset by peer]
ruby has quit [Remote host closed the connection]
ruby has joined #ruby
generalissimo has joined #ruby
kirun has quit [Quit: Client exiting]
cofin has quit [Ping timeout: 260 seconds]
gaahrdner has quit [Read error: Connection reset by peer]
gaahrdne_ has joined #ruby
dangerousdave has quit [Quit: Leaving...]
kpshek has quit []
reset has joined #ruby
<otters>
good question becom33
umren has quit [Read error: Connection reset by peer]
<becom33>
otters, havnt got any awnsers
<becom33>
system('whoami') will work in a linux env but in a windows env ?
mrsolo has joined #ruby
niceguyjames has joined #ruby
Kricir has quit [Remote host closed the connection]
<otters>
maybe you could ask a php channel
kpshek has joined #ruby
jonathanwallace has quit [Ping timeout: 260 seconds]
cofin has joined #ruby
johnkary has quit [Quit: @johnkary]
akhet has quit [Remote host closed the connection]
mixel has joined #ruby
humberto1 has joined #ruby
humberto1 has left #ruby [#ruby]
mmitchell has quit [Ping timeout: 252 seconds]
ebobby has quit [Ping timeout: 248 seconds]
<becom33>
aw shit
<becom33>
my bad
idkazuma has joined #ruby
elaptics`away is now known as elaptics
juarlex has quit [Remote host closed the connection]
narsqt has quit [Remote host closed the connection]
idkazuma has quit [Remote host closed the connection]
ruby has quit [Remote host closed the connection]
ruby has joined #ruby
dustint has quit [Ping timeout: 264 seconds]
crazysim has joined #ruby
jeffreylevesque_ has quit [Quit: ChatZilla 0.9.90 [Firefox 20.0.1/20130409194949]]
saarinen has joined #ruby
kpshek has quit []
alexmreis has joined #ruby
nedbat has quit [Ping timeout: 245 seconds]
brianpWins has joined #ruby
kpshek has joined #ruby
ruby has quit [Remote host closed the connection]
jkline has quit [Ping timeout: 248 seconds]
ruby has joined #ruby
idkazuma has joined #ruby
idkazuma has quit [Read error: Connection reset by peer]
idkazuma has joined #ruby
rvchangue has quit [Ping timeout: 264 seconds]
xcv has quit [Remote host closed the connection]
jkline__ has joined #ruby
jkline__ has quit [Client Quit]
JimmyNeutron has quit [Quit: Leaving]
jeffreylevesque_ has joined #ruby
Davey has quit [Read error: Connection reset by peer]
awojo has joined #ruby
pipework has joined #ruby
johnmilton has quit [Remote host closed the connection]
ebobby has joined #ruby
idkazuma has quit [Remote host closed the connection]
Davey has joined #ruby
r0bby has joined #ruby
LennyLinux has joined #ruby
breakingthings has quit [Remote host closed the connection]
forrest has quit [Quit: Leaving]
breakingthings has joined #ruby
dallasm has joined #ruby
dallasm has quit [Client Quit]
ruby has quit [Remote host closed the connection]
guiocavalcanti has quit [Remote host closed the connection]
ruby has joined #ruby
blandflakes has quit [Remote host closed the connection]
<joshu>
I'm noticing some odd behaviour with def mail_type where all the if statements return false even if one should match. If I comment 3 of the statements the fourth matches correctly
<Xeago>
concerning the bcrypt gem
guiocavalcanti has quit [Ping timeout: 256 seconds]
ruby has joined #ruby
<Xeago>
it string compares hashes using #==
<havenwood>
joshu: Can mail_type be only one of the four options?
<havenwood>
joshu: Looking better. :)
<Xeago>
does #== abort early?
gaahrdne_ has quit [Remote host closed the connection]
<joshu>
havenwood yes FFM processes one email at a time and that email can only be one of the 4 mail_types
<joshu>
havenwood much appreciated!
mrsolo has quit [Read error: Connection reset by peer]
kpshek has quit []
zeeraw has quit [Quit: Computer has gone to sleep.]
mixel has quit [Quit: mixel]
mixel has joined #ruby
kpshek has joined #ruby
jnoob22 has quit [Remote host closed the connection]
breadthfirst has quit [Remote host closed the connection]
pitzips has joined #ruby
breadthfirst has joined #ruby
phipes has quit [Quit: phipes]
Al___ has joined #ruby
cofin has quit [Ping timeout: 256 seconds]
jnoob22 has joined #ruby
interactionjaxsn has quit [Remote host closed the connection]
alex__c2022 has quit [Quit: alex__c2022]
pskosinski has quit [Quit: pskosinski]
mrsolo has joined #ruby
interactionjaxsn has joined #ruby
<havenwood>
joshu: Lines 40-43 are currently each being run, even though only the return of one matters. You could put a `return` before each one-liner, to prevent them from all being checked. Or DRY it up a bit like so: https://gist.github.com/havenwood/340611eacffe26dc782f
`brendan has quit [Quit: - nbs-irc 2.39 - www.nbs-irc.net -]
jerius has quit [Ping timeout: 246 seconds]
MrZYX|off is now known as MrZYX
jlast has quit [Remote host closed the connection]
<havenwood>
Xeago: Thinking of timing attack?
jonathanwallace has joined #ruby
ruby has quit [Remote host closed the connection]
enebo has quit [Quit: enebo]
ruby has joined #ruby
Naeblis|XChat has joined #ruby
_veer has quit [Ping timeout: 248 seconds]
<Xeago>
havenwood: yes
kpshek has quit []
<tomsthumb>
can you have a member variable and a method with the same name in a single object?
<joshu>
havenwood ah your code looks like something I would have written initially if I wasn't trying to do something spiffy as I did with my one liners :P I will refactor to your first version. is my code so far acceptable other than my mail_type method?
<Xeago>
but it is very tiny
interactionjaxsn has quit [Ping timeout: 256 seconds]
<havenwood>
Xeago: Yeah, there is a significant enough difference to be able to be able to tell.
cofin has joined #ruby
Gloridiculous has joined #ruby
Kricir has quit [Remote host closed the connection]
zeeraw has joined #ruby
<havenwood>
Xeago: Devise implemented their bcrypt call with a timing resistant implementation. Attempts to pull that code over to bcrypt-ruby got shot down because it was considered a non-starter vector of attack: https://github.com/codahale/bcrypt-ruby/pull/43
<havenwood>
Xeago: Devise uses | and ^ for standard time comparisons: b.each_byte { |byte| res |= byte ^ l.shift }
<havenwood>
Xeago: TL;DR: bcrypt's preimage resistance makes timing attacks a non-issue
<havenwood>
^ quote**
cofin has quit [Client Quit]
<Xeago>
aware of that :)
Gloridiculous has left #ruby [#ruby]
<Xeago>
the rest of the gem is made very well, and looks like the algorythm is almost swappable
mrsolo has quit [Read error: Connection reset by peer]
lunchtime has joined #ruby
fmcgeough has joined #ruby
lunchtime has quit [Client Quit]
breadthfirst has quit [Remote host closed the connection]
brianpWins has quit [Quit: brianpWins]
<havenwood>
tomsthumb: If a local variable is found, it will be returned and the method by the same name will never get called.
mrsolo has joined #ruby
nowthatsamatt has quit [Quit: nowthatsamatt]
devoldmx3 has joined #ruby
r0bby has quit [Ping timeout: 256 seconds]
jlast has joined #ruby
vlad_starkov has joined #ruby
jlast has quit [Remote host closed the connection]
jlast has joined #ruby
blacktulip has quit [Remote host closed the connection]
<havenwood>
tomsthumb: In a class or module though, no worries. Instance variables are confused with methods.
splittingred has quit [Quit: splittingred]
<havenwood>
aren't***
devoldmx has quit [Ping timeout: 256 seconds]
k610 has quit [Quit: Leaving]
<tomsthumb>
havenwood: ah, hehe, had me scratching my head for a minute, thanks
jY has joined #ruby
kpshek has joined #ruby
<havenwood>
tomsthumb: I need more coffee. :( Not thinking clearly. :P
<jY>
how can i negate this? if @property_hash[:line]? "set"
kpshek has quit [Client Quit]
jlast has quit [Read error: Connection reset by peer]
jlast has joined #ruby
reset has quit [Quit: Leaving...]
johnkary has joined #ruby
vlad_starkov has quit [Ping timeout: 256 seconds]
l33 has quit [Remote host closed the connection]
jdunck has quit [Ping timeout: 245 seconds]
elaptics is now known as elaptics`away
_veer has joined #ruby
_veer has quit [Changing host]
_veer has joined #ruby
baordog has quit [Quit: ChatZilla 0.9.90 [Firefox 20.0.1/20130409194949]]
ruby has quit [Remote host closed the connection]
F1skr has quit [Quit: WeeChat 0.4.0]
ruby has joined #ruby
breadthfirst has joined #ruby
jdunck has joined #ruby
m8 has quit [Quit: Sto andando via]
justsee has joined #ruby
justsee has quit [Changing host]
justsee has joined #ruby
<bean__>
jY: if ! @propery_hash[:line]? "set"
<bean__>
?
<havenwood>
Or 'unless'
allsystemsarego has quit [Quit: Leaving]
<bean__>
yeah
<jY>
thanks
DrShoggoth has joined #ruby
sam113101 has quit [Quit: WeeChat 0.4.0]
ruby has quit [Remote host closed the connection]
toastynerd has joined #ruby
ruby has joined #ruby
nari_ has joined #ruby
becom33 has quit [Quit: Leaving]
breadthfirst has quit [Remote host closed the connection]
kindjal has quit [Ping timeout: 264 seconds]
Al___ has quit [Quit: Al___]
phipes has joined #ruby
bean__ has quit [Quit: Computer has gone to sleep.]
DrHeiter23 has quit [Quit: DrHeiter23]
L8D has quit [Quit: leaving]
alexmreis has quit [Ping timeout: 252 seconds]
sam113101 has joined #ruby
pinpin404 has quit [Read error: Connection reset by peer]
postmodern has joined #ruby
mklappstuhl has quit [Remote host closed the connection]
robottinosino has quit [Ping timeout: 252 seconds]
ruby has quit [Remote host closed the connection]
AlbireoX has quit [Remote host closed the connection]
ruby has joined #ruby
rudisimo has quit [Quit: Leaving.]
LennyLinux has quit [Remote host closed the connection]
mklappstuhl has joined #ruby
prk has joined #ruby
Xeago has quit [Remote host closed the connection]
dallasm has joined #ruby
robottinosino has joined #ruby
tommyvyo has quit [Quit:]
ruby has quit [Remote host closed the connection]
ruby has joined #ruby
shadoi has joined #ruby
mmitchell has joined #ruby
fridim__ has joined #ruby
threesome has quit [Ping timeout: 260 seconds]
dr00bie has quit [Ping timeout: 245 seconds]
frem has quit [Read error: Operation timed out]
Ortuna has joined #ruby
awojo has quit []
mrsolo has quit [Quit: Leaving]
mrsolo has joined #ruby
mmitchell has quit [Ping timeout: 252 seconds]
Kar- has quit [Remote host closed the connection]
toastynerd is now known as tylerm
tylerm is now known as tmorgan
guiocavalcanti has joined #ruby
breadthfirst has joined #ruby
jnoob22 has quit [Remote host closed the connection]
sayan has joined #ruby
ruby has quit [Remote host closed the connection]
saarinen has quit [Quit: saarinen]
ruby has joined #ruby
freakazoid0223 has joined #ruby
Aristata has quit [Quit: Leaving.]
<nettoweb>
is there a better way to do this conditional: <% if (company.nil? == false && @product.user.company.featured < 10) or company.nil? == true or @other_products_seller.size == 0 %> saying of multiples AND/OR in a conditional
<nettoweb>
I use (…) but I dont know if ruby is ok like this
johnkary has quit [Quit: @johnkary]
wsterling has quit [Remote host closed the connection]
chrishough has quit [Quit: chrishough]
Xeago has joined #ruby
guardadigital_ has quit [Read error: Connection reset by peer]
SpxElecxInf has quit [Remote host closed the connection]
tshauck has joined #ruby
markalanevans has quit [Ping timeout: 260 seconds]
<waxjar>
nettoweb some_object.nil? is enough, it'll return a boolean
<nettoweb>
waxjar: you say, company.nil? is the same as company.nil? == false
<nettoweb>
?
devoldmx3 has quit [Ping timeout: 248 seconds]
ruby has quit [Remote host closed the connection]
akells` has quit [Remote host closed the connection]
<waxjar>
no, company.nil? would be the same as company.nil? == true, if you want to check that it's not nil you can do !company.nil? (or (not company.nil?))
ruby has joined #ruby
mixel has quit [Quit: mixel]
nedbat has joined #ruby
<joshu>
if I have a lib directory with two files ffm.rb and header.erb and in ffm.rb I do this File.read(File.expand_path("../header.erb"), __FILE__) why can't it read the file?
twoism has quit [Read error: Connection reset by peer]
geggam has quit [Remote host closed the connection]
twoism has joined #ruby
chandankumar has quit [Ping timeout: 260 seconds]
jonathanwallace has quit [Ping timeout: 240 seconds]
<waxjar>
nettoweb: you could try adding methods to your models (i assume they are) that query them about their state
twoism has quit [Read error: Connection reset by peer]
emergion has joined #ruby
<nettoweb>
waxjar: thank you man
twoism has joined #ruby
mklappstuhl has quit [Remote host closed the connection]
chris__ is now known as codesoda
emergion has quit [Client Quit]
gensym` has joined #ruby
mklappstuhl has joined #ruby
mklappstuhl has quit [Remote host closed the connection]
greenarrow|2 has joined #ruby
danslo has joined #ruby
ebobby has quit [Ping timeout: 264 seconds]
_maes_ has joined #ruby
chrishough has joined #ruby
ruby has quit [Remote host closed the connection]
ruby has joined #ruby
greenarrow has quit [Ping timeout: 264 seconds]
danslo has quit [Client Quit]
slash_nick has quit [Ping timeout: 260 seconds]
decentrality has quit [Quit: decentrality]
l33 has joined #ruby
cofin has joined #ruby
ebobby has joined #ruby
fmcgeough has quit [Quit: fmcgeough]
ruby has quit [Remote host closed the connection]
ruby has joined #ruby
sayan has quit [Read error: Connection reset by peer]
mercwithamouth has quit [Ping timeout: 248 seconds]
danslo has joined #ruby
_veer has quit [Ping timeout: 256 seconds]
jonathanwallace has joined #ruby
niklasb has joined #ruby
jtharris has quit [Quit: WeeChat 0.4.0]
bean__ has joined #ruby
<joshu>
how do I join the following puts "#{@to_local}ENV['FAX_SAAS_PROVIDER_DOMAIN']"
mercwithamouth has joined #ruby
IceDragon has joined #ruby
<joshu>
shouldd I use plus sign
<joshu>
which works but don't know if it's the best way'
breadthfirst has quit [Remote host closed the connection]
akells` has joined #ruby
apalmblad has joined #ruby
reset has joined #ruby
unstable has joined #ruby
Proshot has quit [Quit: Leaving]
unstable has left #ruby [#ruby]
mercwithamouth has quit [Ping timeout: 264 seconds]
ruby has quit [Remote host closed the connection]
ruby has joined #ruby
johnnyfuchs has quit [Ping timeout: 256 seconds]
danslo has quit [Quit: danslo]
_veer has joined #ruby
_veer has quit [Changing host]
_veer has joined #ruby
mixel has joined #ruby
stewart_ has joined #ruby
kil0byte has joined #ruby
tomsthumb has quit [Quit: Leaving.]
DanBurton has quit [Remote host closed the connection]
ruby has quit [Remote host closed the connection]
ruby has joined #ruby
sam113101 has quit [Quit: WeeChat 0.4.0]
sam113101 has joined #ruby
Matip has joined #ruby
bean__ has quit [Quit: Computer has gone to sleep.]
danslo has joined #ruby
slainer68 has quit [Remote host closed the connection]
subbyyy has joined #ruby
johnrlive has joined #ruby
ruby has quit [Remote host closed the connection]
Mattix has quit [Ping timeout: 245 seconds]
ruby has joined #ruby
RORgasm has quit [Remote host closed the connection]
druonysus has joined #ruby
druonysus has joined #ruby
w|t has joined #ruby
rae__ has quit [Quit: rae__]
nezumi has joined #ruby
westoque has joined #ruby
<jeebster>
how can I get a class object if I've got the name in a string?
<waxjar>
the name of a class?
<stewart_>
Kernel.const_get("AwesomeClass")
<jeebster>
stewart: ah ok, thanks
ruby has quit [Remote host closed the connection]
ruby has joined #ruby
Davey has quit [Quit: Computer has gone to sleep.]
teclator has joined #ruby
<stewart_>
thats for 1.9.3 seems to have been removed in 2
Davey has joined #ruby
kofno has quit [Remote host closed the connection]
w|t has quit [Quit: Computer has gone to sleep.]
<stewart_>
jeebster: From memory there is an issue with const_get and autoload classes. So if your doing something in a rails app you might run in to trouble. FYI :)
predator217 has joined #ruby
<jeebster>
I have to use qualified_const_get for nested classes
<jeebster>
I'm on 1.9.3. so I guess it's ok
jacktrick has joined #ruby
<stewart_>
jeebster: yep you should be fine are the classes being autolaoded?
Spami has quit [Quit: This computer has gone to sleep]
<jeebster>
yes
obs has quit [Quit: Konversation terminated!]
<stewart_>
:( might not work then. I remember a while ago having issues around using const_get on autolaoded classes.
<jeebster>
seems to work in the console, guess I'll find out soon enough
teclator has quit [Ping timeout: 256 seconds]
generalissimo has quit [Remote host closed the connection]
predator117 has quit [Ping timeout: 264 seconds]
<stewart_>
but have you already referenced the class?
<stewart_>
in the console?
generalissimo has joined #ruby
<jeebster>
no
ruby has quit [Remote host closed the connection]
<stewart_>
ah ok suppose it should be fine then
mando has quit [Remote host closed the connection]
ruby has joined #ruby
niklasb has quit [Ping timeout: 248 seconds]
zastern_ has joined #ruby
ruby has quit [Remote host closed the connection]
ruby has joined #ruby
haxrbyte has quit [Read error: Connection reset by peer]
zastern_ has quit [Remote host closed the connection]
zastern_ has joined #ruby
zastern has quit [Read error: Connection reset by peer]
tomsthumb has joined #ruby
breadthfirst has joined #ruby
kindjal has joined #ruby
fschuindt has joined #ruby
pipework has quit [Remote host closed the connection]
tylersmith has quit [Remote host closed the connection]