tjohnson has quit [Quit: Connection closed for inactivity]
GaryOak_ has quit [Remote host closed the connection]
baroquebobcat has quit [Ping timeout: 252 seconds]
baroquebobcat_ is now known as baroquebobcat
<godd2>
a5i dhh created rails
<a5i>
I know that
<a5i>
I wonder if he's using nodejs :/
danjordan has quit [Ping timeout: 250 seconds]
<godd2>
He is most likely not
bruno- has joined #ruby
happyp has joined #ruby
<godd2>
(paraphrased) "I am not a programmer, I am a Ruby programmer" - DHH
<happyp>
Is it acceptable to select Ruby as your first development language?
Tinfoilhat_ has quit [Read error: Connection reset by peer]
<havenwood>
happyp: yes
<godd2>
happyp yep!
<Synthead>
I want to install gems into ~/.gem, so I set an env variable GEM_HOME="$HOME/.gem". In my rails project, I did a gem install bundle and bundle install, but if I do rails console, I get this: http://pastie.org/9997274 What am I missing?
<godd2>
happyp most popular languages are acceptable as first languages
<Synthead>
I don't want bundle to install gems to /usr/lib/ruby/gems
<happyp>
I know a little about PHP... enough to understand the purpose of code, but not to write it. Is Ruby written the same way that PHP is? Not in terms of syntax, but where you write your script or function in a single file?
<pipework>
I personally credit DHH with making ruby a hireable language to know, but not for making ruby great or fun. It was both of those things before, during, and will be after, rails.
<jhass>
Synthead: did you export GEM_HOME ?
<happyp>
I've watched tutorials for Python and they wrote code lines almost like a command line instead of markup like you'd see in HTML or PHP files
<havenwood>
a5i: Why not ask if DHH is using VB 1.0?
<jhass>
Synthead: also I would consider a version directory, check the --user-install option to gem and chruby
<godd2>
happyp you can. for bigger projects, you'd want to organize your code across several files though
<pipework>
happyp: Most languages started out as languages for programming, not for generating markup.
<Synthead>
jhass: yes
<pipework>
But both can be used in either way.
<havenwood>
a5i: That would be more likely.
<jhass>
Synthead: gem env output might be helpful
jerematic has quit [Remote host closed the connection]
<a5i>
DHH
<happyp>
Are there any useful sites aside from Codecademy for learning Ruby on Rails? And is RoR OK to start out on or should it just be Ruby only?
<a5i>
Leanr Ruby, than RoR
<havenwood>
happyp: Start with pure Ruby. There're a variety of nice Rack adapters other than Rails.
<GambitK>
I understand most of it but there are a couple of lines that I don't know
patrick99e99 has quit [Read error: Connection reset by peer]
marr has quit []
<GambitK>
address = @address.collect do |a|
<pipework>
Can you imagine how annoying it'd be to manually handle all those code comments?
patrick99e99 has joined #ruby
<GambitK>
is this the correct place to ask?
<leafybasil>
GambitK: sure
nfk has quit [Quit: yawn]
<pipework>
GambitK: collect is a fold over an array. For each item in the collection, run the block with that item. The return value of the block, presuming it's not a raised exception, is returned as an item in the array.
<quazimodo>
I'm not sure if i shuold be relying on files or on tasks
dandaman has quit [Quit: Leaving.]
<quazimodo>
i can depend on my :make_csvs task, but i dont know?
<jhass>
yeah, probably just do that
Hirzu has quit [Ping timeout: 272 seconds]
mistermocha has quit [Ping timeout: 256 seconds]
<quazimodo>
jhass: hrm
<quazimodo>
butts
<quazimodo>
i'd much rather do something like a rule for .xml to .csv
mistermo_ has quit [Ping timeout: 245 seconds]
tkuchiki has joined #ruby
Takle has joined #ruby
<jhass>
but you don't know how many .csv's the .xml will yield, right?
Sawbones has quit [Remote host closed the connection]
<quazimodo>
no
kblake has quit [Remote host closed the connection]
<Nilium>
Turns out converting all our hg repos at work to git is simple. Converting the one and only SVN repo that matters, on the other hand, is downright painful.
<jhass>
that makes it hard to do it with a rule afaik
<quazimodo>
ok
<quazimodo>
i'll do it the other way and use a filename convention and the glob/splat thingo
<jhass>
since a rule basically defines the file to generate, not the source
<Nilium>
Takes forever due to git having to detect branch points
sankaber has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
freerobby has quit [Quit: Leaving.]
<quazimodo>
yep
<quazimodo>
gotcha jhass
blackmesa has quit [Quit: WeeChat 1.1.1]
Megtastique has joined #ruby
Rodya_ has quit [Remote host closed the connection]
Sawbones has quit [Remote host closed the connection]
Takle has quit [Ping timeout: 252 seconds]
rekky has joined #ruby
GnuYawk has joined #ruby
sevvie has joined #ruby
oo_ has quit [Remote host closed the connection]
justin_pdx has quit [Quit: justin_pdx]
adriancb has quit [Ping timeout: 245 seconds]
justin_pdx has joined #ruby
beneggett has joined #ruby
Rodya_ has joined #ruby
DerisiveLogic has joined #ruby
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
segmond has quit [Ping timeout: 255 seconds]
AlexRussia has quit [Ping timeout: 250 seconds]
bricker has quit [Ping timeout: 245 seconds]
ghr has joined #ruby
adriancb has joined #ruby
tus has quit []
it0a has joined #ruby
doodlehaus has quit [Remote host closed the connection]
sevvie has quit [Ping timeout: 256 seconds]
Rodya_ has quit [Ping timeout: 240 seconds]
agarie has joined #ruby
oo_ has joined #ruby
sevvie has joined #ruby
ghr has quit [Ping timeout: 240 seconds]
rekky has quit [Ping timeout: 246 seconds]
AlexRussia has joined #ruby
jamgood9_ has joined #ruby
pullphinger has joined #ruby
bruno- has quit [Ping timeout: 245 seconds]
sarkis has joined #ruby
Dolphi has quit [Quit: Leaving]
jamgood9_ has quit [Ping timeout: 265 seconds]
AlexRussia has quit [Ping timeout: 250 seconds]
segmond has joined #ruby
pwnz0r has joined #ruby
doodlehaus has joined #ruby
AlexRussia has joined #ruby
triple_b has joined #ruby
beneggett has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
swgillespie has joined #ruby
dopie has joined #ruby
agarie has quit [Remote host closed the connection]
bim has quit [Remote host closed the connection]
wookiehangover has quit [Ping timeout: 256 seconds]
philwantsfish has quit [Ping timeout: 264 seconds]
adriancb has quit [Remote host closed the connection]
n80 has quit [Quit: n80]
adriancb has joined #ruby
doodlehaus has quit [Remote host closed the connection]
wookiehangover has joined #ruby
davejacobs has quit [Remote host closed the connection]
Megtastique has quit []
Rodya_ has joined #ruby
adriancb_ has joined #ruby
jerematic has joined #ruby
sankaber has joined #ruby
<Qladstone>
is converting a hash into an array an expensive operation?
<jhass>
compared to?
<Qladstone>
hmm let me describe
beneggett has joined #ruby
tcrypt has joined #ruby
adriancb has quit [Ping timeout: 244 seconds]
<Qladstone>
let's say I have a large array (list) of projects that employees have worked on
<Qladstone>
each item in that list is an array with index0 being the project_name, and the index1 being an array of many person_name # people who have worked in that project
jerematic has quit [Ping timeout: 256 seconds]
zacstewart has joined #ruby
Adran has quit [Read error: Connection reset by peer]
<Qladstone>
so I want to create the opposite. a list of people, with the projects they have worked on in the same format
krz has joined #ruby
dandaman has joined #ruby
tunaCanBruh has joined #ruby
<Qladstone>
but the final format is an array, not a hash
sankaber has quit [Ping timeout: 252 seconds]
beneggett has quit [Client Quit]
sarkis has quit [Ping timeout: 272 seconds]
<Qladstone>
one way is to create a hash; then for each person_name under a project_name, check if the hash contains that person's name, if so then append the project_name to the list of projects
<Qladstone>
if not create a key for person_name and create an empty array as the value for that key, and append the project_name
<Qladstone>
but in the end the hash will need to be converted back into an array -.-
lkba has quit [Ping timeout: 252 seconds]
<jhass>
my point is that every operation is expensive compared to not doing it, so while "is X more expensive than Y", or "is X more efficient than Y" is a valid consideration, "is X expensive" on its own in most cases is not
<Qladstone>
the other method I thought of, is conducting a binary search and insert operation
<Qladstone>
so instead of using a hash to start with, I first create an empty array
sdrew has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Qladstone>
I do a binary search of the person_name, if exist I add the project_name to it, else I create the person_name at the spot and add the project_name to it
<havenwood>
Qladstone: Could you show an small example of the input you're starting with and the output you desire?
<jhass>
Qladstone: do whatever, if it's slow look to optimize
<Qladstone>
oh you mean the conversion from hash to array
<jhass>
also there's more efficient in memory usage and more efficient in CPU time, which often are negatively correlating
fabrice31 has joined #ruby
<havenwood>
Qladstone: well, whatever you're starting with, if it's a Hash then yeah
<Qladstone>
so that hash will be { person1 => [project1, project2, project3], person2 => [project1, project2, project3] }
shevy has quit [Ping timeout: 245 seconds]
amystephen has quit [Quit: amystephen]
badfish129 has joined #ruby
bhegel has quit [Quit: bhegel]
<jhass>
Qladstone: but again, start with the solution you can write fast and that's the most understandable, not what you think runs the fastest, if it actually turns out too slow, then optimize
<Qladstone>
alright good advice (; haha thanks so much
<certainty>
arup_r: IMHO it depends on how your brain works. just like with programming languages. some suite your way of thinking better and feel more comfortable
<certainty>
also of course i like emacs because it's exensible with elisp
<arup_r>
humm
<flughafen>
certainty: i'll be switching to neovim with the first release
<arup_r>
flughafen: what's that ?
<shevy>
arup_r I don't see how you can shorten this
<arup_r>
Not me too.. I tried to DRY it, shevy. but I made it so ugly than it was
Hirzu has quit [Client Quit]
<certainty>
arup_r: i don't see much repition in that code. I'm a bit surprised by the instance variable. Id'd not expect a getter to update my instance variable (unless it does some lazy assignment)
<flughafen>
arup_r: a bunch of guys got crowd sourcing to refactor and improve vim,
sevvie has quit [Ping timeout: 265 seconds]
amundj has joined #ruby
<arup_r>
certainty: ok
OrbitalKitten has joined #ruby
<certainty>
arup_r: also the dryer version is alot less clear. The question is whether the conditionals are likely to get more
<certainty>
then i'd think about solving it in another way
<flughafen>
arup_r: the guy tried to get these changes into upstream vim, but they didn't want them, so they forked and now have neovim. i'm actually surprised and impressed by how much they've done and how fast they've gone
<arup_r>
flughafen: ok.. Does neovim support console running within vim .. like emacs ?
Aswebb_ has joined #ruby
mistermocha has joined #ruby
<flughafen>
arup_r: not really sure, but I think the work they'll do will pave the way for allowing it. one of their key goals is to improve/add async handling so it'll work a lot faster with plugins.
<certainty>
arup_r: well the only thing that is repeated is update_value(something) if receive.some_pred? .. so you could think about extracting that. a method probably not the best choice since your get string pretty much looks like a reduce. You probably want something callable. So a small class (a formatter) would probably do. That's just quick things i'd ponder. i'm not sure it's the right way.
<certainty>
but with the current amount of conditionals i'd just leave it the way it is
sevvie has joined #ruby
yfeldblum has joined #ruby
<arup_r>
certainty: thanks.. Yes.. current amount is very little.. I was looking at its broader way ..
<certainty>
for me one of the strenghts of emacs is its dynamic environment. you can update the UX while it runs and tweak it to your likings. Also elpa and all the many packages are great
<certainty>
arup_r: also the exam.is_something? is slightly suspicious. I'd check if that's a case to apply the tell-don't-ask principle
<wasamasa>
there is a neovim branch that supports terminal emulation
hs366 has joined #ruby
<certainty>
brb
mistermocha has quit [Ping timeout: 265 seconds]
<wasamasa>
someone already ran emacs in it
<wasamasa>
so, I guess it's on!
<arup_r>
wasamasa: wow.. that's cool
<arup_r>
That's lacking in traditional vim
<wasamasa>
yup
Xiti has quit [Quit: Xiti]
<arup_r>
But it is really needed
<arup_r>
some plugins are there.... But those are not as useful as it seems
<arup_r>
Well.. I'm not considering Tmux... :)
<arup_r>
Talking about Vim's own features
<arup_r>
certainty: waiting ... :)
fabrice31 has quit [Remote host closed the connection]
<shevy>
I prefer to use linux rather than emacs as my OS
mkaesz has joined #ruby
fabrice31 has joined #ruby
<arup_r>
wut? :p
jenrzzz has joined #ruby
ptrrr has joined #ruby
<shevy>
if only we could use macros to modify ruby
lemur has quit [Remote host closed the connection]
sarkis has quit [Ping timeout: 264 seconds]
fabrice31_ has joined #ruby
abuzze has joined #ruby
reinaldob has joined #ruby
piotrj has quit [Remote host closed the connection]
piotrj has joined #ruby
ta has joined #ruby
ta has quit [Read error: Connection reset by peer]
ta has joined #ruby
fabrice31 has quit [Ping timeout: 246 seconds]
krz has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
<aob>
i have a little script which runs a job which takes about 10 secs and produces some data which i write out; what's the best way to run this all the time? atm i am doing it in a bash while true loop, which is rubbish!
Jetchisel has quit [Quit: "Unfortunately time is always against us" -- *Morpheus*]
reinaldob has quit [Ping timeout: 250 seconds]
abuzze has quit [Ping timeout: 264 seconds]
jenrzzz has joined #ruby
RegulationD has joined #ruby
frobs has quit [Quit: Konversation terminated!]
wallerdev has joined #ruby
lordkryss has joined #ruby
lkba has quit [Read error: Connection reset by peer]
davejacobs has quit [Remote host closed the connection]
lkba has joined #ruby
funburn has quit [Quit: funburn]
RegulationD has quit [Remote host closed the connection]
RegulationD has joined #ruby
<Schmidt>
aob: what platform?
joonty has joined #ruby
amundj has quit [Ping timeout: 256 seconds]
<shevy>
aob ruby also has loop {} - you can also daemonize it
amundj has joined #ruby
mikecmpbll has joined #ruby
<gr33n7007h>
aob, make it a cron job if on linux
sevenseacat has quit [Remote host closed the connection]
RegulationD has quit [Ping timeout: 255 seconds]
ghr has joined #ruby
<gr33n7007h>
aob, have you lost your fingers ;p
<aob>
sorry!
<aob>
i was making coffee!
alex88 has joined #ruby
<gr33n7007h>
lol
<aob>
Schmidt: mostly linux
<aob>
Schmidt: i want finer granularity than 1 min
Guest78105 has joined #ruby
<aob>
the job takes 10 secs, i basically want it to run again as soon as it finisged
swgillespie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
RegulationD has joined #ruby
<Schmidt>
aob: then daemonize it and just keep on running it
<aob>
right i tried to daemonize it with 'foreverb'
<aob>
but it didn't seem to generate output after the first run
<aob>
what's the recommended way to daemonise a very simple job?
<plasku>
thanks sandelius and shevy
jimms has quit [Ping timeout: 256 seconds]
Hirzu has joined #ruby
<shevy>
ah sandelius was idling!
oddmunds has joined #ruby
<aob>
this literally shells out and runs a command that get some status, and pulls out some stuff based on a regex and posts it to an endpoint
<shevy>
certainty I use it personally. others can also use it. https://rubygems.org/gems/cookbooks but I broke it a while ago; you notice the large size though, that's because there are so many yaml files hehehe
<shevy>
so now I am once again rewriting everything :(
leafybasil has quit [Remote host closed the connection]
amundj has joined #ruby
rekky has joined #ruby
<certainty>
shevy: the ultimate goal is to have a ruby package manager?
<plasku>
I'm trying to find out how the general structure of a ruby program written without libs is. requires at the top, constants below, where do I throw the defs etc?
<avril14th>
diegoviola: what's wrong with it?
<certainty>
diegoviola: your code can't breath
<avril14th>
ahah
pheona has quit [Quit: WeeChat 1.0.1]
<arup_r>
diegoviola: there?
iamdoo2 has joined #ruby
bjornar has quit [Remote host closed the connection]
* arup_r
feel he knows a bit RSpec .. Thanks to avril14th:
<shevy>
certainty the goal is to have a set of tools that do everything related to installing/compiling/building. I'd even love to get away with libtool one distant tool; the umbrella project is called rbt "ruby build tools"; cookbooks is the component for all installable programs
<certainty>
diegoviola: there are not blank lines :) Also for tests it's good to see the different parts of the spec. setup some context, execute something, verify the outcome.
<certainty>
shevy: interesting
frobs has quit [Remote host closed the connection]
frobs has joined #ruby
<certainty>
diegoviola: also it's common for tests to only have one reason to fail
martinbmadsen has quit [Ping timeout: 272 seconds]
nettoweb has joined #ruby
sevvie has joined #ruby
<diegoviola>
makes sense, thanks
sandelius has joined #ruby
jimms has quit [Ping timeout: 252 seconds]
workmad3 has joined #ruby
segmond has joined #ruby
JohnBat26 has joined #ruby
robustus has quit [Ping timeout: 255 seconds]
tunaCanBruh has joined #ruby
Qladstone has quit [Remote host closed the connection]
Guest123 has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
startupality has joined #ruby
segmond has quit [Ping timeout: 245 seconds]
sandelius has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
diego1 has quit [Changing host]
diego1 has joined #ruby
diego1 is now known as diegoviola
rodfersou has joined #ruby
rodfersou has quit [Client Quit]
RegulationD has joined #ruby
rodfersou has joined #ruby
troulouliou_div2 has joined #ruby
joonty has quit [Quit: joonty]
Soda has quit [Read error: Connection reset by peer]
<arup_r>
Is it "Ask don't tell" or "Tell don't ask" too much confusing..
plashchynski has joined #ruby
RegulationD has quit [Remote host closed the connection]
Regulati_ has joined #ruby
<workmad3>
arup_r: tell don't ask
wmoxam has quit [Remote host closed the connection]
<arup_r>
ok
Guest123 has joined #ruby
grrrr_ has quit [Remote host closed the connection]
FooMunki has quit [Read error: No route to host]
FooMunki has joined #ruby
rrrutr has quit [Quit: Leaving]
n008f4g_ has quit [Ping timeout: 252 seconds]
Regulati_ has quit [Ping timeout: 264 seconds]
Waheedi has joined #ruby
Musashi007 has quit [Quit: Musashi007]
<arup_r>
OOP came into existence as we were unhappy with procedure programming.. Is it true ?
RegulationD has joined #ruby
Qladstone has joined #ruby
gfawcettpq has joined #ruby
<norc>
Hi. Im writing a wrapper for some piece of hardware, that can have a number of different "slots" each with "ports". Now my interface requires specific implementations of functions on port level, that depends on what slot it resides in.
senayar has quit [Remote host closed the connection]
fabrice31_ has quit [Remote host closed the connection]
Takle has quit [Remote host closed the connection]
Takle has joined #ruby
troulouliou_div2 has quit [Changing host]
troulouliou_div2 has joined #ruby
polysics has quit [Remote host closed the connection]
mkaesz has joined #ruby
paradoja has quit [Ping timeout: 265 seconds]
joonty has joined #ruby
RegulationD has quit [Ping timeout: 265 seconds]
polysics has joined #ruby
Aswebb_ has quit []
Soda has joined #ruby
wallerdev has quit [Quit: wallerdev]
oo_ has quit [Remote host closed the connection]
ndrei has quit [Ping timeout: 246 seconds]
DerisiveLogic has joined #ruby
Criztian has joined #ruby
fabrice31 has joined #ruby
sandelius has joined #ruby
FooMunki has quit [Quit: FooMunki]
ndrei has joined #ruby
FooMunki_ has joined #ruby
Zai00 has quit [Quit: Zai00]
nfk has joined #ruby
polysics has quit [Remote host closed the connection]
rekky has joined #ruby
DerisiveLogic has quit [Ping timeout: 252 seconds]
ixti has joined #ruby
polysics has joined #ruby
robustus is now known as robustus|Off
mistermocha has joined #ruby
_ixti_ has quit [Ping timeout: 264 seconds]
ndrei has quit [Ping timeout: 264 seconds]
<workmad3>
norc: I tend to be wary of dynamic mixins... they bust method caches and can cause severe slowdowns... so I'd probably go for something more along these lines: https://gist.github.com/workmad3/c6eb029e54edcb867a6e
polysics has quit [Ping timeout: 245 seconds]
wpp has joined #ruby
mistermocha has quit [Ping timeout: 265 seconds]
diego1 has joined #ruby
diegoviola has quit [Ping timeout: 250 seconds]
thumpba has joined #ruby
<jhass>
norc: yeah, flip the inheritance outside in there, extract the common functionality into modules, not the specific one
shredding has quit [Ping timeout: 250 seconds]
rodfersou has quit [Quit: leaving]
joonty has quit [Quit: joonty]
rodfersou has joined #ruby
joonty has joined #ruby
diego1 has quit [Changing host]
diego1 has joined #ruby
diego1 is now known as diegoviola
emocakes has quit [Ping timeout: 256 seconds]
ismaelga has joined #ruby
paradoja has joined #ruby
ndrei has joined #ruby
thumpba has quit [Ping timeout: 244 seconds]
<norc>
workmad3: Ok that took me a bit to understand what you are doing there.
doodlehaus has joined #ruby
<certainty>
arup_r: yeah that was one reason. (of course whether or not OOP was the correct move has to be judged seperately)
<norc>
jhass: Im not sure what you mean by that exactly. Were you referring to my pastie?
<workmad3>
norc: it's pretty much what jhass just said, but I went for a superclass rather than common module include approach (as I figured IS_A models the relationship from a general Slot to a TypeA slot accurately)
ldnunes has joined #ruby
jerematic has joined #ruby
<norc>
jhass / workmad3: The reason I split the specific functionality into modules is because I wanted to have separate files for each "type"
<jhass>
norc: think about classical inheritance, you wouldn't put the more specific code into the parent, likewise don't put the more specific code into the module, put the shared code there
<workmad3>
norc: you can still organise the files like that with other approaches (like the one I showed)
<shevy>
put it everywhere!
<jhass>
neither approach prevents having multiple files
ismaelga has quit [Ping timeout: 272 seconds]
<certainty>
time for the lunch walk
<norc>
Oh silly me yeah.
jaygen has joined #ruby
<shevy>
certainty nono
<shevy>
certainty don't do the lunch walk, do the lunch DANCE man
<workmad3>
certainty: do a break-dance/parkour fusion dance around the cafeteria!
<workmad3>
certainty: also film it, so I can see what break-dance/parkour fusion looks like ;)
<arup_r>
certainty: ok
jerematic has quit [Ping timeout: 244 seconds]
<arup_r>
workmad3: lol
Waheedi_ has joined #ruby
razieliyo has joined #ruby
IrishGringo has joined #ruby
<norc>
workmad3: So basically I would specialize for each slot type this way? http://pastie.org/9998800
Zai00 has joined #ruby
<workmad3>
norc: sure, except you'll probably find it neater if you did 'class Slot::TypeA < Slot'
razieliyo has joined #ruby
Waheedi has quit [Ping timeout: 264 seconds]
Waheedi_ is now known as Waheedi
<norc>
workmad3: Oh yeah, naturally.
<workmad3>
norc: similarly, you can do 'class Slot::TypeA::Port < ::Port' if you wanted your slots and ports in separate files too
davejacobs has joined #ruby
<workmad3>
norc: but yeah, the point is that it makes more sense usually to create concrete instances of specialisations, rather than create a concrete instance of some generic thing and then try to specialise it dynamically
<workmad3>
norc: easier to reason about, easier to visualise, easier to work with and debug, etc.
<jhass>
norc: I'd choose a module to include over parent class because it makes no sense to have an instance of Slot itself as far as I understood. In places where you use an abstract base class in other languages I tend to use a module in Ruby
ndrei has quit [Ping timeout: 250 seconds]
Criztian has quit []
<norc>
jhass: Personally I wouldnt really know how to do the same thing with module. I mean the superclass approach workmad3 has shown me seems fairly straight forward and what he explained makes sense to me.
zorak8 has joined #ruby
<jhass>
norc: it's simple, instead of class Slot; def common_code; end; end; class SlotA < Slot; end; you do module Slot; def common_code; end; end; class SlotA; include Slot; end;
<jhass>
the only difference is that you can no longer make an instance of Slot
davejacobs has quit [Ping timeout: 244 seconds]
shum has joined #ruby
<norc>
jhass: Mhm, it would also remove the "Slot::" namespace from SlotA, which is handy I suppose.
<jhass>
norc: no, you could just keep it
<jhass>
after all Class is a specialization of Module
<jhass>
a Class does pretty much everything a Module, it just specializes it to have a new functionality (making instances) you don't need from Slot in this case
<norc>
jhass: That is interesting. So essentially Id just be changing the Slot from class to module, and include it rather than inherit. The entire rest actually stays?
<norc>
jhass: Doesnt that mean that there is no big difference between inheritance and include?
<norc>
if any
<workmad3>
norc: you can only inherit from a class, you can only include modules, and you can only inherit from one class while you can include multiple modules
joonty has quit [Quit: joonty]
<jhass>
what he said
<norc>
workmad3: Sure, I just meant functionality wise.
<workmad3>
norc: however, the way that mixins work is effectively the same as inheritance (inserts into ancestors chain), but the mechanism prevents 'diamond of death' scenarios because there's always a deterministic linear ordering to the ancestors
Tomtom22 has joined #ruby
zacstewart has joined #ruby
Zackio has quit [Remote host closed the connection]
Zackio has joined #ruby
amundj has quit [Ping timeout: 244 seconds]
tunaCanBruh has joined #ruby
<workmad3>
norc: there's also the difference that if you inherit from a class, all the superclass's class methods are accessible as class methods on the subclass, but if you include a module, you don't gain access to the module methods as class methods
Tomtom22 has quit [Remote host closed the connection]
pwnz0r has joined #ruby
<workmad3>
norc: or, in code, 'class Foo; def self.hi; end; end; class Bar < Foo; end #Bar.hi works' while 'module Foo; def self.hi; end; end; class Bar; include Foo; end; #Bar.hi doesn't work'
Hackn9 has joined #ruby
<norc>
workmad3: Isnt that actually a reason I cant actually switch the class for a module in your example, since there is a class method (self.create) ?
<norc>
(Well, I meant just blindly turn it into a module and include rather than inherit)
amundj has joined #ruby
<jhass>
just for completeness, the class methods are inherited because class Foo < Bar; end; makes Foos singleton class inherit Bars singleton class
hichtech has joined #ruby
ndrei has joined #ruby
<workmad3>
norc: no, that works fine still in this instance, because you're calling Slot.create directly, you're not trying to call it on a subclass of Slot
joonty has joined #ruby
<norc>
workmad3: Okay yeah I really need to lose the concept of dynamic dispatch through vpointers in my mind.
segmond has joined #ruby
<workmad3>
norc: basically, Slot.create is a factory method that gives you back a slot object based on the specification you passed in
tunaCanBruh has quit [Ping timeout: 245 seconds]
segmond has quit [Max SendQ exceeded]
grrrr_ has joined #ruby
pwnz0r has quit [Ping timeout: 256 seconds]
adac has joined #ruby
<workmad3>
norc: and the factory method doesn't really care where it's located (unlike the current implementation of create_port, which depends on self.class::Port existing)
blackmesa has quit [Ping timeout: 245 seconds]
<adac>
Time.now gives me for example: "2015-03-04 13:09:11 +0100" is there a way to drop the +0100 information on Time.now?
<jhass>
adac: .utc
B1n4r10 has joined #ruby
Takle has quit [Remote host closed the connection]
joset has quit [Remote host closed the connection]
robustus|Off is now known as robustus
postmodern has quit [Quit: Leaving]
claptor has quit [Quit: this channel is bakas]
<certainty>
workmad3: i tried todo that dance. all that happend was me walking in circles for 20 minutes
<certainty>
i almost puked
oki has quit [Ping timeout: 246 seconds]
<workmad3>
certainty: did you at least do a suicide drop at the end?
rekky has quit [Remote host closed the connection]
piotrj has quit [Remote host closed the connection]
lanemeyer has quit [Ping timeout: 244 seconds]
piotrj has joined #ruby
<certainty>
workmad3: i considered commiting suicide when i thought i couldn't stop you mean that
<arup_r>
rand(10) will give me one random number.. what if I need say N ramdom numbers ? What's the way ?
<adac>
hmm lets ask differently: how can I convert a string ie: "2015-03-04 12:50:00" to a datetimeobject with the correct timezone information (in my case +0100)
<jhass>
now even three!
hanmac1 has joined #ruby
<arup_r>
jhass: I am looking for a Array#sample(n) kind of thingy
<jhass>
adac: strptime should use local timezone when none specified
<arup_r>
But not having an array
rekky has joined #ruby
<jhass>
arup_r: just make one
<arup_r>
Array ?
<jhass>
Array.new(N) { rand(10) }
<arup_r>
Wow...
<arup_r>
thanks
<arup_r>
I knew you guys can do it
<certainty>
the royal you :)
blackmesa has joined #ruby
<arup_r>
certainty: who ?
<certainty>
jhass:
<certainty>
without the :
* jhass
feels naked without the :
jonr22 has quit [Ping timeout: 265 seconds]
<arup_r>
hehehe
sarkis has joined #ruby
neanderslob has quit [Remote host closed the connection]
tmi_ has joined #ruby
tkuchiki has joined #ruby
Mon_Ouie has joined #ruby
segmond has joined #ruby
Phage has joined #ruby
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Phage>
I'm trying to create a tool to open a site with my PHPSESSIONID and grab a string which is displayed on the site.
<Phage>
But I'm just so confused on Mechanize.
<Phage>
Any tips?
rekky has quit []
<Phage>
I have written the code in Python, but I'm in the process of moving to Ruby.
<adac>
jhass, I tried: Date.strptime "2015-03-04 12:50:00", '%Y-%m-%d %H:%M:%S %Z' but that gives me "invalid date"
arup_r has quit [Remote host closed the connection]
<certainty>
there is no timezone in that string that could be parsed
pontiki has joined #ruby
<jhass>
adac: yap, you don't have a zone so don't specify %Z
sarkis has quit [Ping timeout: 265 seconds]
it0a has quit [Ping timeout: 246 seconds]
<adac>
jhass, that results in: Date.strptime "2015-03-04 12:50:00".to_s, '%Y-%m-%d %H:%M:%S'
<adac>
=> Wed, 04 Mar 2015
amundj has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<adac>
shouldn't there be the output in the format i suggested?
<jhass>
you wanted a DateTime, so call it on DateTime
<adac>
jhass, ah right! Thanks!
gccostabr has joined #ruby
pwh has joined #ruby
<jhass>
adac: also the to_s seems unnecessary in your example
ghostpl_ has quit [Remote host closed the connection]
grrrr_ has quit [Remote host closed the connection]
<adac>
jhass, yeah it comes froma previous attempt :)
<jhass>
what's your goal btw?
<jhass>
where does that date come from?
<adac>
jhass, the date comes form an input of a rake task
arup_r has joined #ruby
<jhass>
ah, k
<adac>
th reake task then should select a range in the database like:
<jhass>
which timezone are dates in your DB actually?
serivich has joined #ruby
<workmad3>
jhass: rails converts datetimes to UTC and stores them without TZ info in the database (annoyingly)
<jhass>
adac: ^ keep the parsing like you have it and call Time.now.utc
<adac>
jhass, the db is UTC
<jhass>
oh, nvm
<jhass>
skipped breakfast I guess :P
segmond has quit [Ping timeout: 264 seconds]
<workmad3>
adac: with the query you showed then AR will ensure times are in UTC before creating the SQL query
sivsushruth has joined #ruby
joonty has joined #ruby
ms7 has joined #ruby
DouweM has joined #ruby
<workmad3>
adac: so if that's coming out incorrectly, that would imply (to me) that your from date isn't in UTC already, so by treating it as such you're losing important info
<avril14th>
There's something I don't get. On a MatchData, how can offset(i) not be equal to the length of match's i-th group?
zorak8 has quit [Ping timeout: 256 seconds]
senayar has joined #ruby
<adac>
workmad3, jhass using Time.now.utc saves the problem
Pumukel has joined #ruby
<adac>
*solves the problem
<adac>
ain't savving nothing actually :)
qis has joined #ruby
<ms7>
Can anyone help me figure out why I can’t find a link with a specific href using capybara? Here’s a paste of the test, html snippet and the error message: http://pastebin.com/NL8Cd42g
doodlehaus has quit [Remote host closed the connection]
<avril14th>
I don't get, these are supposed to be the starting and ending positions
<adac>
jhass, nope t does not solve the problem. I was looking at the wrong output. I need to bring the "from" time string to utc+1
<avril14th>
so end - start should equal length
<jhass>
ms7: how did you verify the HTML is there?
skmp has quit [Quit: Connection closed for inactivity]
<ms7>
jhass: ah, I have to provide that html with a fixture of some sort?
<adac>
jhass, If I don't want to give an utc input of course
senayar has quit [Ping timeout: 246 seconds]
<jhass>
adac: yeah, I'm not too firm with AS added Time/DateTime stuff, so I'd just go for adding %Z and appending +0100 to the input (Or Time.now.zone)
anaeem1__ has joined #ruby
ponga has quit [Quit: Leaving...]
<ms7>
jhass: if that’s the case, it’s odd because when I remove the href option from the click_link method, the test passes with has_content? ‘Parking’
hirogen has joined #ruby
cpt_yossarian has quit [Quit: And then he took off.]
<hirogen>
hi
senayar has joined #ruby
<hirogen>
have a chap whos trying to import data from ruby, its some standalone application inhouse btut based on ruby, hes importing into powerpoint
<hirogen>
and he gets the followin gerror
<avril14th>
jhass: what does offset second value represent if not a position?
<jhass>
ms7: that gets into the specifics of your application and tests of which you told us nothing so far ;)
RegulationD has quit [Remote host closed the connection]
Qladstone has quit [Remote host closed the connection]
tvw has joined #ruby
<jhass>
ms7: but I guess you need to pick the ID from the object you create in your tests setup
bim has quit [Ping timeout: 256 seconds]
nixmaniack has quit [Remote host closed the connection]
amundj has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
n80 has joined #ruby
<ms7>
jhass: now to find where that is :) I think I made some progress, thank you jhass
mikecmpbll has quit [Read error: Connection reset by peer]
phale has joined #ruby
<phale>
i need to learn ruby quickly
<phale>
very quickly i have to go to work soon
polysics has joined #ruby
<jhass>
then don't wast time here
Feyn has quit [Quit: Leaving]
<phale>
okay
otisZart has joined #ruby
<phale>
but i need a good book
robustus is now known as robustus|Off
<phale>
that explains the language greatly
<phale>
should also have exercises
ghostpl_ has quit [Remote host closed the connection]
<ms7>
eloquent ruby?
<phale>
ms7: it has exercises?
<ms7>
phale: no idea, but I’ve heard it compares to eloquent javascript, which has plenty of exercises
Regulati_ has quit [Ping timeout: 255 seconds]
DouweM has quit [Quit: Leaving...]
<phale>
okay thanks
<ms7>
np
ndrei has quit [Ping timeout: 252 seconds]
zorak8 has quit [Ping timeout: 245 seconds]
n1x has joined #ruby
amundj has joined #ruby
sevvie has quit [Ping timeout: 264 seconds]
grn has joined #ruby
a5i has joined #ruby
RegulationD has joined #ruby
mikecmpbll has joined #ruby
jtdowney has joined #ruby
vt102 has joined #ruby
sevvie has joined #ruby
phale has quit [Quit: leaving]
spyderman4g63 has joined #ruby
detail_pratique has joined #ruby
<grn>
Hi! I'm iterating like https://gist.github.com/grn/9307b70899bd06e807fb. However the assignment on line 4 creates a new local variable instead of setting the one introduced on line 1. How to fix this?
spyderma_ has joined #ruby
ghostpl_ has joined #ruby
<jhass>
grn: You know about Enumerable#find ?
jerematic has joined #ruby
tus has joined #ruby
oki has joined #ruby
n1x has quit [Remote host closed the connection]
<grn>
jhass: it's more complicated than that. I need to reuse this value in the iteration.
qis has left #ruby [#ruby]
<jhass>
>> a = nil; [1,2,3].each do |n| a = n; end; a
<hirogen>
the addin for powerpoint has buttons called pullnewdatadeslected
grrrr_ has joined #ruby
ponga has quit [Read error: Connection reset by peer]
ponga has joined #ruby
amundj has joined #ruby
sarkis has quit [Ping timeout: 245 seconds]
jlast has joined #ruby
Parker0 has joined #ruby
Parker0 has quit [Client Quit]
adriancb_ has joined #ruby
mistermocha has joined #ruby
blackmesa has quit [Ping timeout: 252 seconds]
doodlehaus has joined #ruby
ismaelga has joined #ruby
Deele has joined #ruby
bim has joined #ruby
sambao21 has quit [Quit: Computer has gone to sleep.]
RegulationD has joined #ruby
Aryasam has quit [Ping timeout: 250 seconds]
iamjarvo has joined #ruby
mistermocha has quit [Ping timeout: 265 seconds]
foureight84 has joined #ruby
coderhs has joined #ruby
Channel6 has joined #ruby
robustus|Off is now known as robustus
danman has joined #ruby
vasilakisfil_ has joined #ruby
iamjarvo has quit [Client Quit]
foureight84 has quit [Client Quit]
<vasilakisfil_>
could you please help me understand this part of code? http://pastie.org/9999050 in the helpers do ... end section
Pumukel has quit [Ping timeout: 265 seconds]
<vasilakisfil_>
from what I understand helpers is a class method that accepts a block
<vasilakisfil_>
inside the helpers do ... end self refers to the Core class.. right ?
RegulationD has quit [Ping timeout: 250 seconds]
<vasilakisfil_>
also, methods defined inside the helpers do...end are not visible outside the block
<vasilakisfil_>
what I really want is to define such methods (inside helperd do...end) dynamically..
<vasilakisfil_>
does anyone know how can I achieve that ?
ta has quit [Remote host closed the connection]
tjohnson has joined #ruby
mitchellhenke has joined #ruby
<vasilakisfil_>
I know that to define dynamically a method you can send the method name in the define_method method using send().. but inside the helpers which is the object to send the send() method ?
tkuchiki has quit [Remote host closed the connection]
<shevy>
that code looks super complicated
tkuchiki has joined #ruby
<vasilakisfil_>
it's a middleman extension..
<shevy>
helpers() seems to be a method on class Core
<vasilakisfil_>
nd I want to define some helpers (methods available in middleman templates).. but I want the methods to have a name based on the name of the files under data/
<vasilakisfil_>
yes that's what I think too
marx has quit [Ping timeout: 244 seconds]
<vasilakisfil_>
shevy the problem is more general.. let's say that you have a block like helpers there.. in which you want to define some methods using metaprogramming. I don't know how to do that..
beneggett has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rdark has quit [Quit: leaving]
kalusn has joined #ruby
GnuYawk has joined #ruby
tkuchiki has joined #ruby
withnale__ has quit [Ping timeout: 264 seconds]
GnuYawk has left #ruby [#ruby]
delianides has quit [Remote host closed the connection]
blueOxigen has joined #ruby
bluOxigen has quit [Ping timeout: 255 seconds]
ismaelga has joined #ruby
aerth has quit [Ping timeout: 264 seconds]
agarie has quit [Remote host closed the connection]
delianides has joined #ruby
dago has joined #ruby
aerth has joined #ruby
adriancb has quit [Read error: No route to host]
tkuchiki has quit [Ping timeout: 265 seconds]
adriancb_ has joined #ruby
odigity has joined #ruby
dago has left #ruby [#ruby]
gfawcettpq has joined #ruby
byprdct has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
cjim has joined #ruby
The_Phoenix has quit [Quit: Leaving.]
tgunr has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
n008f4g_ has joined #ruby
deuterium has quit [Quit: zzZZZzzz..]
dfinninger has quit [Remote host closed the connection]
freerobby has quit [Quit: Leaving.]
piotrj has quit [Remote host closed the connection]
zorak8 has joined #ruby
GaryOak_ has quit [Remote host closed the connection]
mjuszczak has quit []
dtordable has quit [Quit: • IRcap • 8.72 •]
freerobby has joined #ruby
ghr has joined #ruby
jottr_ has joined #ruby
sj has joined #ruby
RandyT_ has quit [Read error: Connection reset by peer]
RegulationD has joined #ruby
einarj has joined #ruby
CustosLimen has joined #ruby
Crisix has joined #ruby
RandyT has joined #ruby
workmad3 has quit [Ping timeout: 264 seconds]
shanlar has quit [Quit: shanlar]
diegoviola has quit [Quit: WeeChat 1.1.1]
ghr has quit [Ping timeout: 246 seconds]
ascarter has joined #ruby
RegulationD has quit [Ping timeout: 256 seconds]
einarj has quit [Ping timeout: 246 seconds]
shanlar has joined #ruby
djbkd has joined #ruby
GaryOak_ has joined #ruby
rbennacer has joined #ruby
<phale>
COLORS = { 0 => String.colors[:black] }
<phale>
this will give me a symbol to integer error
tgunr has joined #ruby
<phale>
how do I fix
coldkey21 has quit [Quit: Leaving]
fantazo has joined #ruby
B1n4r10 has joined #ruby
adac has quit [Quit: Leaving]
sevvie has quit [Remote host closed the connection]
baweaver has joined #ruby
<eam>
phale: like this?
sevvie has joined #ruby
<eam>
>> [1, 2, 3][:foo]
<eval-in>
eam => no implicit conversion of Symbol into Integer (TypeError) ... (https://eval.in/296024)
ismaelga has quit [Remote host closed the connection]
<jhass>
phale: I guess String.colors is an array, not hash
B1n4r10 has quit [Max SendQ exceeded]
iamjarvo has joined #ruby
djbkd has quit [Remote host closed the connection]
<phale>
jhass: yes
<phale>
an array
triple_b has joined #ruby
<phale>
returns symbols though
<eam>
phale: but it doesn't take symbols in the [] index
<jhass>
what do yu expect some_array[:a_symbol] to do?
<phale>
oh yeah you're right
thebastl has joined #ruby
piotrj has joined #ruby
<phale>
thanks this works
<phale>
i have now rendered my picture in ascii
<phale>
pretty cool
blueOxigen has quit [Ping timeout: 246 seconds]
bluOxigen has joined #ruby
triple_b has quit [Client Quit]
djbkd has joined #ruby
gfawcettpq has quit [Ping timeout: 264 seconds]
gfawcettpq has joined #ruby
Bounga has quit [Quit: Bounga]
blueOxigen has joined #ruby
shadeslayer has quit [Ping timeout: 240 seconds]
buub has joined #ruby
Limix has joined #ruby
shadeslayer has joined #ruby
tunaCanBruh has joined #ruby
Takle has joined #ruby
The_Phoenix has joined #ruby
djbkd has quit [Remote host closed the connection]
piotrj has quit [Ping timeout: 240 seconds]
ki0 has joined #ruby
bluOxigen has quit [Ping timeout: 246 seconds]
sandelius has joined #ruby
startupality has quit [Quit: startupality]
mjuszczak has joined #ruby
fryguy9 has quit [Quit: Leaving.]
piotrj has joined #ruby
serivichi has joined #ruby
max96at|off is now known as max96at
spider-mario has quit [Ping timeout: 265 seconds]
tcrypt has joined #ruby
zachrab has quit [Ping timeout: 245 seconds]
skj3gg has joined #ruby
jenrzzz has joined #ruby
<baweaver>
Interesting idea for all of you. What if RSpec could be parsed by a second gem, and instead of being regarded as a BDD language it's regarded as a logic language? As to why, think mock service builders that stay up to date with your test frameworks at various levels of an app.
RegulationD has joined #ruby
ki0 has quit [Ping timeout: 245 seconds]
piotrj has quit [Remote host closed the connection]
tvw has quit [Remote host closed the connection]
<Sou|cutter>
not sure I see where the logic is in the DSL, so I struggle to understand quite what you're thinking about
<baweaver>
could be flipped to reflect the condition that when a described method is called with x it does y and returns a value
adriancb_ has quit [Read error: No route to host]
<baweaver>
(* noted this is a very early concept idea I'm throwing against a wall a bit for amusement at this point)
lordkryss has quit [Quit: Connection closed for inactivity]
fryguy9 has joined #ruby
HoloIRCUser has joined #ruby
<Sou|cutter>
have you seen rspec-given?
<baweaver>
Not offhand
* baweaver
googles
triple_b has joined #ruby
adriancb has joined #ruby
<baweaver>
Ah Jim, RIP.
<Sou|cutter>
I'm still not sure I understand what you're getting at, but at least based off the example you gave it sorta sounds more like the Given DSL
Hirzu_ has quit [Remote host closed the connection]
<baweaver>
You have a SOA
<baweaver>
and need to mock the next level up
<Sou|cutter>
yeah, unfortunately I am not aware if any of the efforts to fork/maintain it have been successful
<baweaver>
but don't want to have to keep changing your client every time that's updated
<baweaver>
so the rspec from the service generates a mock service of itself.
rhg135|zzz is now known as rhg135
SouL has joined #ruby
<baweaver>
as the rspec describes the exact behavior of the service if done well.
OrbitalKitten has joined #ruby
<phale>
if in ruby, i create a program
<phale>
is the program interpreted or compiled
<phale>
or both
<baweaver>
Which Ruby?
plashchynski has quit [Quit: plashchynski]
<phale>
1.9.3
<phale>
at least my version
<baweaver>
MRI Interpreted, JRuby compiled in some cases.
<phale>
okay
<baweaver>
If you don't know, you're likely MRI
<Sou|cutter>
you should really upgrade versions also FWIW
<baweaver>
JRuby runs on the JVM
plashchynski has joined #ruby
<baweaver>
That too, 1.9.3 is deprecated.
<baweaver>
as of.... last week was it?
<phale>
Sou|cutter: yeah but the problem is
patrick99e99 has quit [Quit: leaving]
<phale>
I am a sane person
xEA1E5788 has joined #ruby
patrick99e99 has joined #ruby
* baweaver
scratches head
graydot has quit [Quit: graydot]
<phale>
I just don't like Ruby 2
<atmosx>
phale: a sane person wouldn't use 1.9.3
<baweaver>
leaving yourself vulnerable to security breaches by using an old version does not seen same to me mate
anime4christ has joined #ruby
<phale>
baweaver: i run most of my programs in a sandbox
nettoweb has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<baweaver>
then go to python where they treat that like a normal thing
<baweaver>
won't help
<phale>
alright
<phale>
what's so different about ruby 2 and 1.9.3?
<baweaver>
One's supported
<atmosx>
phale: too many to mention really.
djbkd has joined #ruby
<baweaver>
mainly performance
<baweaver>
syntactically? Not an incredible amount.
paradoja has quit [Ping timeout: 265 seconds]
<atmosx>
phale: huge memory performance improvement, especially since 2.2.0 game around (GC etc.)
<phale>
oh cool
<phale>
any new methods
mjuszczak has quit []
<baweaver>
Tons
<atmosx>
phale: sure
<baweaver>
Anythink like the print hell from Python? No, we're the sane ones.
<baweaver>
*anything
plashchynski has quit [Client Quit]
* baweaver
is still leery of python and it's 2/3 divide shenanigans.
<havenwood>
phale: 2.0 is in maintenance mode and will reach end of life in less than a year.
<baweaver>
Just go 2.2, chances are very slim you hit anything bad from it.
pullphinger has joined #ruby
<baweaver>
Rather the point is to do rolling updates as they come so you're not versions behind and cropped by the deprecation train.
<havenwood>
phale: 2.2.1 or 2.1.5 are fine choices and will run whatever you had on 1.9 or 2.0.
<baweaver>
1.8.6 to 1.9.3 was the bad one.
<phale>
omg i hate myself now
plashchynski has joined #ruby
<phale>
now i have to update all of my projects
<phale>
all of it is now gone
<phale>
damn
<baweaver>
...dramatic much mate?
<jhass>
phale: the only changes that *might* be breaking is that String#chars, Sting#bytes etc. no longer return an Enumerator but an array. But even there most calls will continue to work
<atmosx>
phale: you must update "all" of your projects?
<havenwood>
Then there'll be another painless bump to 2.3. And then... A compatibility-breaking but refined and much faster Ruby 3.0! \o/
<baweaver>
You just change the .ruby-version if you use RVM and install the new version.
<atmosx>
havenwood: \o/
mjuszczak has joined #ruby
ascarter has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<phale>
alright thanks guys this is good ruby
graydot has joined #ruby
* atmosx
loves rvm
* atmosx
good ruby
<baweaver>
Just hope we don't end up like Python on our 2/3 jump....
<havenwood>
baweaver: certainly wont
<atmosx>
baweaver: I don't think so.
<baweaver>
I still can't take that language seriously after that nonsense.
<havenwood>
baweaver: they offered breaking changes with no carrot
<phale>
the only thing I dislike about python is indentation
<phale>
making code very unreadable
cjim has quit [Quit: (null)]
<atmosx>
I don't dislike anything really, about python. But the version thing is hilarious
<baweaver>
ironic as that's supposed to make it more readable, but anyways.
<havenwood>
baweaver: I'd expect Ruby 3 to be quickly and widely adopted.
chrishough has joined #ruby
<atmosx>
it's like if 70% of the language/projects decided to stay back.
kirun has joined #ruby
Megtastique has joined #ruby
<baweaver>
Let's hope so. I don't think it'll be an issue, but stranger things.
OrbitalKitten has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jhass>
well, if we're honest we had the same thing as python 2/3 with Ruby 1.8/1.9
<baweaver>
except our people upgraded
<havenwood>
baweaver: If we were going to have had a Python 2/3 debacle it'd have been the 1.8 to 1.9 jump.
<eam>
baweaver: "our people upgraded" isn't really true, distros (rhel, osx) shipped 1.8.7 for a loooong time
<jhass>
wrapper is broken I guess
<baweaver>
interesting trick.
<eam>
the majority of my prod systems still have a 1.8.7 /usr/bin/ruby
<havenwood>
RHEL is *special*.
<jhass>
baweaver: ^ what eam is saying is what I meant
<eam>
havenwood: it's really not
<baweaver>
yeah
<jhass>
havenwood: Debian & Ubuntu too really
tkuchiki has joined #ruby
<eam>
I'd say the impact differed primarily because no one was using ruby for systems stuff
<havenwood>
jhass: They have nice modern packages.
<baweaver>
Ubuntu still feels like a phone to me now, but that's a different matter.
<jhass>
these days
<eam>
havenwood: none of the distros used for enterprise had newer versions
<jhass>
for far too long they didn't
* baweaver
uses ruby for systems stuff
<havenwood>
RHEL is like a time machine to the past.
<eam>
anyone working on big scale projects uses a container which has a 4-6 year lifecycle
adriancb has quit [Read error: Connection reset by peer]
<baweaver>
We just use AWS and deploy a new stateless container for versions
<havenwood>
jhass: Not super nice like Arch or Fedora packages. And yeah, they've gotten better over time but still aren't ever quite up-to-date. At least we have Brightbox packages and other options.
thebastl has quit [Quit: Leaving...]
<jhass>
yeah
<jhass>
btw anybody knows if the brightbox packages would crash a debian?
<nickjj>
has anyone ever used nokogiri to extract a twitter id from the iframe that twitter's widget js returns?
<eam>
baweaver: yes I do, very well
<phale>
okay
sevvie has quit [Ping timeout: 250 seconds]
<baweaver>
He has some good stuff, I tend to watch around his blog on occasion. Him and cirwin / banisterfiend
<havenwood>
phale: use the block form of File::open, it's idiomatic and auto-closes the file unlike your current code which is leaving it open since there's no explicit #close.
<baweaver>
cirwin is actually around SoMa as well at Bugsnag
<eam>
yeah he's fantastic to work with
ki0 has joined #ruby
xEA1E5788 has quit [Quit: leaving]
<havenwood>
fun to hang out with too
<baweaver>
I'll have to catch some more bay area folks for coffee some time. Still fairly new to the area.
Hirzu has joined #ruby
<havenwood>
Wish they had a high speed train already so I could come up to SF more often from LA.
<eam>
baweaver: that'd be rad :) I'm a native, but I prefer the east bay
<baweaver>
Ping me if you're ever up this way. I live in Dublin
spider-mario has joined #ruby
<eam>
baweaver: hah - I live in Pleasanton
<baweaver>
because $3k rent is nope
<eam>
we're neighbors
<baweaver>
I just take East bart in from Dublin, bike there.
<phale>
i want to puts if a newline has been found after a number
ych4k3r has joined #ruby
fantazo has quit [Ping timeout: 246 seconds]
tunaCanBruh has quit [Ping timeout: 250 seconds]
<monsieurp>
is there something like cpantesters for Ruby that isn't Travis CI? (I'm aware of it, I simply wanna know if another similar platform exists)
<shevy>
then check for that phale
<phale>
but width only splits ints
<phale>
im really confused
tunaCanBruh has joined #ruby
jp-znc has quit [Quit: ZNC - 1.7.0-git-20-048d118 - http://znc.in]
fantazo has joined #ruby
<havenwood>
phale: So you just want to read the file content? I'm more confused.
<jhass>
monsieurp: mmh, drone.io
<havenwood>
phale: `File.readlines('xoxo').join` is equivalent to `File.read('xoxo')`.
<monsieurp>
jhass: another company behind it
<monsieurp>
;)
<havenwood>
phale: You're putting extra newlines on it.
<monsieurp>
like Travis
n5418 has joined #ruby
<jhass>
somebody gotta pay those boxes, no?
jlast has joined #ruby
<monsieurp>
how do the chaps at cpantesters manage to pay the bills then?
triple_b_ has joined #ruby
<jhass>
do I look like a perl guy that would know?
<phale>
i want to
<monsieurp>
of course not
<phale>
do something like this
<phale>
color color color color color (NEWLINE HERE)
<phale>
color
<phale>
color color color ...
<monsieurp>
but your point is not valid
The_Phoenix has quit [Quit: Leaving.]
<monsieurp>
you pay if you wanna pay
<jhass>
monsieurp: Travis is open source
<monsieurp>
..backed by a company
The_Phoenix has joined #ruby
<jhass>
get a server farm and set it up in that model
<jhass>
argoneus: new to programming in general or new to ruby?
<argoneus>
new to ruby
<shevy>
phale yes that is fine, in the above example 'color ' is a string, in your example you can add a variable or anything else inside the block; you can space the block onto multiple lines, or use do/end rather than the {]
<argoneus>
I have a bit of experience in C/java/python
<shevy>
I mean {}
<argoneus>
also did a bit of smalltalk
<phale>
okay shevy
<argoneus>
but this syntax isn't making much sense to me and I can't find anything on google
<argoneus>
I mean, I can tell what it does
<jhass>
argoneus: that's calling the method on, passing the argument :message, the argument "hello" and a block
<argoneus>
but how does that work
<shevy>
String.colors[i] looks weird, you wanted String.colors(i) ?
<phale>
what array is array?
<phale>
shevy: no it's literally an array
<shevy>
hehe
jonr22 has quit [Ping timeout: 256 seconds]
<argoneus>
jhass: what is the |m| thing?
<argoneus>
I thought it was a local variable
<argoneus>
but apparently it's some sort of object
<jhass>
argoneus: a block parameter or block argument
<jhass>
(argument and parameter are used synonym)
<phale>
shevy: ?
Soda has quit [Read error: Connection reset by peer]
<shevy>
phale well can you add minimal more code to your codepad example? but .map or .map! seems to be just fine for what you described so far
<argoneus>
I'm still confused ._.
<jhass>
argoneus: which language can we relate to?
<shevy>
I don't know what is .colorize() there, seems to be a custom method from you?
<jhass>
argoneus: Js is easiest here, the block is sort of like an anonymous function, on("message", "hello", function(m) {
<argoneus>
oh
jp-znc has joined #ruby
<argoneus>
what kind of parameter is :message ?
<argoneus>
it's more like
<shevy>
argoneus a Symbol
<phale>
shevy: yeah i wasn't sure what to do
<havenwood>
shevy: indeed, unless you're trying to double space :p
<argoneus>
on(message, "Hello", function(m) { } ) then
<argoneus>
right?
shum has joined #ruby
mjuszczak has quit [Client Quit]
<jhass>
argoneus: no, a Symbol is a value
<argoneus>
oh
<shevy>
phale yeah, you need to slow down and go step by step. the .join does not seem to make a lot of sense unless you want "\n\n" results
rodfersou has quit [Read error: Connection reset by peer]
<argoneus>
so it's some hardcoded event ID or such?
<jhass>
argoneus: it's used as an identifying value, for example where you use an enum in other languages
<jhass>
yeah
<argoneus>
I see
ferr has quit [Ping timeout: 264 seconds]
<shevy>
phale ah you wanted a string, well... why not File.read
JDiPierro has quit [Read error: Connection reset by peer]
<havenwood>
phale: Look at the result in irb or Pry for each step.
<argoneus>
and the |m| part
<phale>
good idea
<argoneus>
where exactly does the m get its value?
JDiPierro has joined #ruby
<shevy>
but actually you have to decide what you want first hehehe
<argoneus>
I never understood that much in JS, tbh
<jhass>
argoneus: from the code that calls the block
<argoneus>
when there's function(event) { }
<argoneus>
hmm
<shevy>
phale it might be simplest if you manipulate your data, before you start to output it
edwardly has quit [Quit: ??????????]
<argoneus>
callbacks are too hard for me
<shevy>
in your current code, you iterate, then manipulate while you iterate, then output
sarkis_ has joined #ruby
Hirzu has joined #ruby
<shevy>
argoneus all Proc.new in ruby!
<jhass>
argoneus: when the method is directly calling the block it typically uses the yield statement to call it, def on; msg = receive; yield message; end, there message ends up in m
larsam has quit [Quit: larsam]
<phale>
shevy: okay
mary5030 has joined #ruby
snockerton has joined #ruby
<phale>
i'm now reading the file
<phale>
what do i do now
c355E3B has joined #ruby
<shevy>
phale apply .map
<jhass>
argoneus: in this case the block is likely stored for later, def on(&block) @callbacks << block; end; ... message = receive; @callbacks.first.call(message)
<phale>
shevy: to what array?
<shevy>
phale on the array
<phale>
width?
<shevy>
phale the File.readlines array
snockerton has quit [Client Quit]
<phale>
you said not to use readlines
<shevy>
nono
<phale>
just read it in
<phale>
dude
<phale>
omg
<jhass>
argoneus: I'm simplifying quite a bit here from the real code of course
<shevy>
it depends on what you need
serivichi has quit [Ping timeout: 255 seconds]
<shevy>
you used the .join example, not me
sarkis has quit [Ping timeout: 264 seconds]
<phale>
shevy: okay
hollywood has quit [Quit: Leaving]
<shevy>
I love File.readlines
<jhass>
argoneus: best is to type out some simple code yourself that tries to use them
mkaesz has quit [Ping timeout: 252 seconds]
mesamoo has quit [Quit: Konversation terminated!]
<phale>
ok
<phale>
it is applied
<argoneus>
hmm
<phale>
i just puts it now?
<shevy>
phale verify that you applied the transformation first
<shevy>
phale use p your_object; or require 'pp'; pp your_object
yfeldblum has joined #ruby
swgillespie has joined #ruby
<argoneus>
thanks jhass I'll just read up about it and try things out
<Senjai>
unless you install them to a specific path
<phale_>
shevy im so confused ;(
<phale_>
i have height
<argoneus>
jhass: oh I see that's usefu
<argoneus>
l
<phale_>
which will print out three lines of colours
<shevy>
phale_ you only gave this a name
JDiPierro has quit [Remote host closed the connection]
<ddv>
phale_, pro tip just read 'The Ruby Programming Language'
<jhass>
argoneus: it's no form of concurrency, no, it's giving control to the caller and then returns from it once the block finished
<shevy>
phale_ break your code into smaller chunks
<shevy>
height = File.readlines(ARGV[0]); p height
<argoneus>
jhass: once the block finished?
<shevy>
why do you call it height anyway when you also need width WHERE IS WIDTH
<argoneus>
I just looked at an example that was like
<argoneus>
yield "hi", puts "yo", yield "hey yo", and when it was called, it wrote them in this order
<phale_>
shevy
<phale_>
oh
<jhass>
argoneus: with yield, you can literally imagine the code of the block to be inserted into your method at the place you call yield, if that helps
cpt_yossarian has joined #ruby
<argoneus>
OHHH
jenrzzz has quit [Ping timeout: 240 seconds]
<argoneus>
so when I yield a
<argoneus>
I basically call an anonymous function with the parameter a
<argoneus>
this is executed
<jhass>
yes
<argoneus>
and then it continues
<jhass>
yes
<argoneus>
so in the example
<argoneus>
on :message, "hello" do |m| { stuff }
<phale_>
i gotta go to sleep
phale_ has quit [Quit: leaving]
<argoneus>
there is a "yield something" in the "on" function
sambao21 has quit [Quit: Computer has gone to sleep.]
<argoneus>
then?
rbennacer has quit [Remote host closed the connection]
<jhass>
argoneus: there could be, however I seem to recognize that line of code from the cinchrb examples and in that case there's not :P
<argoneus>
oh
<argoneus>
and yeah it's cinch
<argoneus>
but still
agarie has joined #ruby
<argoneus>
this lets me write generic functions
<argoneus>
where I can fill in things however I want
JDiPierro has joined #ruby
<jhass>
exactly
<jhass>
that's the main point of it
<argoneus>
so instead of having two functions that look almost the same
<argoneus>
I have one and I pass it different code blocks every time
<jhass>
in the cinchrb there's actually a reference to the block stored for later
<preyalone>
Ah, --system works like npm -g
jottr_ has quit [Ping timeout: 240 seconds]
<argoneus>
I actually didn't dare to look at the implementation
pandaant has quit [Remote host closed the connection]
tunaCanBruh has joined #ruby
werelivinginthef has joined #ruby
sevvie has quit [Ping timeout: 265 seconds]
baweaver has joined #ruby
robustus is now known as robustus|Off
zenith_ has joined #ruby
cjim has quit [Read error: Connection reset by peer]
triple_b has joined #ruby
cjim has joined #ruby
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Fusl has quit [Read error: Connection reset by peer]
cjim_ has joined #ruby
spyderma_ has joined #ruby
Fusl has joined #ruby
sambao21 has quit [Quit: Computer has gone to sleep.]
reset has joined #ruby
EasyCo has joined #ruby
triple_b has quit [Client Quit]
Zleec has joined #ruby
Zleec has quit [Client Quit]
spyderm__ has joined #ruby
blandflakes has quit [Quit: Page closed]
spicerack has quit [Ping timeout: 240 seconds]
jaequery has joined #ruby
werelivinginthef has quit [Ping timeout: 245 seconds]
beneggett has quit [Remote host closed the connection]
tkuchiki has joined #ruby
spyderman4g63 has quit [Ping timeout: 252 seconds]
kalusn has quit [Remote host closed the connection]
apeiros_ has quit [Remote host closed the connection]
piotrj has joined #ruby
kirun has quit [Quit: Client exiting]
apeiros_ has joined #ruby
cjim has quit [Ping timeout: 252 seconds]
Zai00 has joined #ruby
sevvie has joined #ruby
ldnunes has quit [Quit: Leaving]
spyderma_ has quit [Ping timeout: 272 seconds]
startupality has quit [Quit: startupality]
tkuchiki has quit [Ping timeout: 256 seconds]
mjuszczak has joined #ruby
<shevy>
hmm question
c355E3B has quit [Quit: Leaving]
Crisix has quit [Ping timeout: 245 seconds]
<shevy>
I can now use sendmail + ruby mail gem to send mails, even from a .cgi file. But how can I tie the send-email part to a button-click event on a web interface?
sambao21 has joined #ruby
<argoneus>
my plugin doesn't work ;_;
x1337807x has joined #ruby
<apeiros_>
shevy: button click is a client side event. the server knows nothing about it. you have to inform it. e.g. via an ajax call.
snockerton1 has quit [Quit: Leaving.]
<shevy>
oh
snockerton has joined #ruby
<apeiros_>
or your button must be a submit button of a form
mjuszczak has quit [Client Quit]
foureight84 has joined #ruby
HoloIRCUser has quit [Remote host closed the connection]
x1337807x has quit [Read error: Connection reset by peer]
jonr22 has joined #ruby
ki0 has joined #ruby
swgillespie has joined #ruby
<argoneus>
how does this work
mistermocha has quit [Remote host closed the connection]
davejlong has quit [Remote host closed the connection]
startupality has joined #ruby
<CustosLimen>
does ruby gems allow two versions of same library to be installed at once ?
odigity has quit [Ping timeout: 265 seconds]
<havenwood>
CustosLimen: yes
Soda has quit [Remote host closed the connection]
fabrice31 has joined #ruby
<CustosLimen>
ok and it resolves them correctly, so if one runnable script needs version 1, and another runnable script needs version 2 - it will figure it out ?
<apeiros_>
no, you have to tell it
<CustosLimen>
I see
<apeiros_>
the default is the newest installed version
serivichi has joined #ruby
<apeiros_>
you can tell it externally (bundler is the most popular option for this) or internally, using the `gem` method.
<baweaver>
shevy: I did
paulfm has quit [Quit: Zzzzz...]
<shevy>
beaver!
<shevy>
you are alive
<baweaver>
I use it for when some people can't decide between typing-like-this or typing_like_this or freaking typingLikeThis
dtordable has quit [Quit: • IRcap • 8.72 •]
<baweaver>
useful for finding potential duplicates in a database.
<baweaver>
distance 3-4 normally has a good hit rate.
<shevy>
ah
<shevy>
interesting
<baweaver>
helps for reconciling inconsistencies in a database quickly
Hijiri has quit [Quit: WeeChat 1.0.1]
<shevy>
<baweaver> useful for finding potential duplicates in a database.
<shevy>
you are a very clever beaver
<baweaver>
or a very lazy one who didn't want to do that by hand
b_k has joined #ruby
<baweaver>
and by which laziness found a better way
<shevy>
wait until beavers use chainsaws
GnuYawk has joined #ruby
<shevy>
they are already called "ecosystem engineers" in ecology, even without having to earn a degree!
fabrice31 has quit [Ping timeout: 245 seconds]
<b_k>
anyone have experience using a gem called feedjira?
ki0 has quit [Remote host closed the connection]
<baweaver>
also I tend to ask about it in interviews ;)
Crazy_Atheist has quit [Ping timeout: 272 seconds]
jen_ has joined #ruby
<baweaver>
huh, so it's not an atlassian thing
<baweaver>
nope, haven't then
lanemeyer has quit [Ping timeout: 245 seconds]
<baweaver>
mainly some variant of how would you catch duplicates in a database like that. I prefer to ask things that I know have come up before instead of odd trick questions.
kalusn has joined #ruby
agent_white has joined #ruby
b_k has left #ruby [#ruby]
<baweaver>
Aw, he left. Well that's no fun. Doesn't look like a hard gem, just expected it to be some Jira feed thing.
* baweaver
shrugs
<baweaver>
ah well
agarie has quit [Remote host closed the connection]
odigity has joined #ruby
otisZart has quit [Remote host closed the connection]
zenith_ has quit [Remote host closed the connection]
red_horned_rihno has quit [Ping timeout: 272 seconds]
delianides has quit [Remote host closed the connection]
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
<jhass>
godd2: because apple knows better than you?
<ponga>
lol
Rapier- has joined #ruby
<godd2>
jhass I’m on Windows and it’s only happening in mirc and it only started happening 2 minutes agoi
<workmad3>
godd2: stop using word as an IDE :P
enebo has quit [Quit: enebo]
<jhass>
godd2: mirc, that still exists?
<jhass>
or maybe microsoft thought knowing better is cool if apple does it so they copy pasted the "smart" quote feature?
DavidDudson has joined #ruby
tkuchiki has joined #ruby
DavidDudson has quit [Client Quit]
beneggett has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<jerematic>
Can anyone with capistrano experience point me in the right direction. I'm trying to manage multiple branches of the same repository for multiple sites stored in a yaml doc, like this: http://pastebin.com/t9Dak4At Does each site need a separate stage?
sdothum has joined #ruby
vt102 has quit [Remote host closed the connection]