crimezone20xx has quit [Ping timeout: 252 seconds]
<GreatSUN>
louism2__: or ...
<GreatSUN>
louism2__: can you nopaste your code?
emergion has joined #ruby
celestius has quit [Quit: Computer has gone to sleep.]
<havenwood>
louism2__: nope
jjbohn has joined #ruby
<GreatSUN>
oh havenwood :-)
<GreatSUN>
maybe you can help me
<louism2__>
havenwood: so I would have to explicitly make the rescue block return false?
<GreatSUN>
I have a hash and need to walk through if I reached the level where I can get a value instead of another hash, I need to set some value according to the value I got to the same path I have been walking through
<havenwood>
louism2__: yes
nari has joined #ruby
w400z has quit [Quit: Computer has gone to sleep.]
<louism2__>
havenwood: thanks
<GreatSUN>
havenwood: do you have an idea how to do that?
sepp2k has quit [Remote host closed the connection]
<havenwood>
GreatSUN: Not sure I get it. Could you give an example input and expected output?
tjbiddle_ has joined #ruby
bigoldrock has quit [Ping timeout: 245 seconds]
lobak_ has quit [Quit: No Ping reply in 180 seconds.]
<GreatSUN>
not pretty sure if this is the right way
tjbiddle has quit [Ping timeout: 248 seconds]
EPIK has joined #ruby
<Spooner>
GreatSUN, !destvalue.is_a?(String)
<GreatSUN>
Spooner: yeah, ok
<Spooner>
I like this: "The user was too lazy to give a description"
<GreatSUN>
Spooner: hehe
<GreatSUN>
sorry
<GreatSUN>
it's late over here
<havenwood>
So you want to recursively crawl a hash until you find a particular key, then you set just that one keys' value?
BSaboia has quit [Read error: Connection reset by peer]
<GreatSUN>
and my night will be over in about 5 hours ;-)
bubblehead has joined #ruby
louism2__ has left #ruby ["Leaving"]
<GreatSUN>
havenwood: kind of... I use the value to detect what value to set at the same path into another hash
Guedes0 has quit [Ping timeout: 245 seconds]
<GreatSUN>
Spooner: so, any ideas on the rest?
momomomomo has quit [Ping timeout: 240 seconds]
<havenwood>
GreatSUN: So recursively crawl hash to find key, and return the value and tree location?
bradleyprice has quit [Remote host closed the connection]
Sicp has quit [Quit: Leaving]
bean has quit [Quit: Computer has gone to sleep.]
<havenwood>
GreatSUN: Stop on first matched key?
<GreatSUN>
havenwood: that's easy, cause the method does it already in my opinion
<GreatSUN>
havenwood: but how do I set the detected value in the same path in another variable(hash)?
<GreatSUN>
havenwood: nope
<GreatSUN>
walk through the whole hash
<GreatSUN>
and set all detected values to the according tree-paths into another variable
swounding60 has quit [Ping timeout: 248 seconds]
<GreatSUN>
The main problem is, I can save the path into an array, but how do I access the other variable then at this path?
freeayu has joined #ruby
mlpinit has joined #ruby
tylersmith has quit [Quit: tylersmith]
mengu has quit [Quit: This computer has gone to sleep]
<havenwood>
GreatSUN: So you want a mirror hash, that just contains the found key/value pairs? Or you want a list of the found values with where they came from?
cobragoat has quit [Remote host closed the connection]
bean has joined #ruby
<GreatSUN>
havenwood: it is not a real copy
<GreatSUN>
havenwood: else it would be an ease
matayam has quit [Remote host closed the connection]
mellowMike has joined #ruby
<GreatSUN>
havenwood: it is first of all only a copy of the key structure, but not of the values
<havenwood>
jurassic_: I use single quotes unless there is actually a need for double.
<pioz>
Summary: no speed difference; this collaborative ruby style guide recommends using 'string' unless interpolation is needed.
<pioz>
:D
<jurassic_>
Cool, thanks. Easier to type, too :)
<pioz>
yep
slainer68 has quit [Remote host closed the connection]
jjbohn has joined #ruby
mattbl has joined #ruby
generalissimo has joined #ruby
lolzie has joined #ruby
ferdev has quit [Quit: ferdev]
<lolzie>
Is there any particular common convention of invoking self.method rather than just method(), within a class?
<lolzie>
I like it more but wouldn't want to offend future Rubyists I work with by bringing other language idioms into my code for no reason other than tradition. hehe
<Spooner>
lolzie, You only _need_ it with self.attr = 4
ArchBeOS has joined #ruby
ArchBeOS has quit [Changing host]
ArchBeOS has joined #ruby
<lolzie>
Spooner: I'm talking stylistic convention/clarity rather than necessity
ArchBeOS has left #ruby [#ruby]
NiteRain has quit [Ping timeout: 264 seconds]
Guedes0 has joined #ruby
<pioz>
i use always self.method
<Spooner>
Don't if you don't need it ;) Occasionally, it is clearer to use it. Mostly I don't see people using it.
jgrevich has joined #ruby
twoism has quit [Remote host closed the connection]
<havenwood>
Taco Tuesday, i'm off to get tacos and beer!
havenwood has quit [Remote host closed the connection]
<welandB>
Funny, it's taco tuesday here, too.
tcopp has joined #ruby
stevechiagozie has quit [Quit: Computer has gone to sleep.]
havenwood has joined #ruby
banjara has quit [Quit: Leaving.]
maxmanders has quit [Ping timeout: 248 seconds]
<sam113102>
havenwood: why does it work?
mmitchell has quit [Remote host closed the connection]
mmitchell has joined #ruby
<bnagy>
because class << self kind of drops you into the class object itself ( called eigenclass or metaclass or singleton class or ... )
<bnagy>
so then when you include in that context the methods are added to the class object, not to instances of the class
mellowMike has quit [Ping timeout: 245 seconds]
havenwood has quit [Ping timeout: 245 seconds]
<lewix>
things you learn...
emmanuelux has quit [Remote host closed the connection]
dhruvasagar has joined #ruby
angusiguess has quit [Ping timeout: 252 seconds]
idkazuma has joined #ruby
Gues_____ has joined #ruby
<bnagy>
if you want it for classes, though, just extend the module, don't piss about with class << self
alainus has joined #ruby
<alainus>
when using bootstrap to create a view, how can i insert </div><div class="row-fluid"> (meaning to start a new row), every time the counter reaches the number of spans i want for each row?
<bnagy>
... actually I think extend is always better that that code :)
<bnagy>
alainus: try one of the rails channels
<alainus>
bnagy, isn't that a programatic question regarding a ruby loop and a counter ?
heliumsocket has quit [Quit: heliumsocket]
<bnagy>
no idea because I don't know what a view or a bootstrap or a div or a span is
maxmande_ has quit [Ping timeout: 248 seconds]
Domon has joined #ruby
markalanevans has quit [Ping timeout: 264 seconds]
<bnagy>
so it's unclear which part of the process you're finding difficult
<alainus>
then, how can i insert a string every time the counter reaches a predefined number of counts?
hamakn has joined #ruby
reset has joined #ruby
<bnagy>
myabe do_something if counter % 100 == 0
<alainus>
thanks
jgrevich has joined #ruby
banjara has joined #ruby
kofno has quit [Remote host closed the connection]
bricker`LA has joined #ruby
chessguy has joined #ruby
sleetdrop has joined #ruby
r126l_ is now known as r126l
tomsthumb has quit [Quit: Leaving.]
angusiguess has joined #ruby
slainer68 has joined #ruby
jurassic_ has quit [Quit: jurassic_]
dmerrick has quit [Quit: dmerrick]
heliumsocket has joined #ruby
lolzie has quit [Quit: Page closed]
_veer has joined #ruby
_veer has quit [Changing host]
_veer has joined #ruby
slainer68 has quit [Ping timeout: 252 seconds]
kofno has joined #ruby
ThePicard is now known as ThePicard90033
fir_ed has joined #ruby
fir_ed is now known as GIANT_CHICKEN
<peteyg_>
When iterating in something like .each, .map or any other enumerable, is there a built-in shortcut handle for which element the current iteration is on? Kind of like how $! is a shortcut variable for the exception that's currently being caught?
<banisterfiend>
peteyg_: nup, u gotta use each_with_index
sleetdrop has quit [Quit: Computer has gone to sleep.]
nari has joined #ruby
<bnagy>
banisterfiend!
<peteyg_>
banisterfiend: Okeys. Thanks
<bnagy>
what you doing up, dude, or are you back in civilisation?
<banisterfiend>
bnagy: about to sleep :P
<bnagy>
haha ok
<banisterfiend>
hehe
banisterfiend is now known as banister`sleep
<banister`sleep>
nite
<lewix>
banister`sleep:
<bnagy>
\o
mrsolo has quit [Quit: Leaving]
ttt has joined #ruby
<lewix>
oh he went to bed
codesoda has joined #ruby
jjbohn has quit [Quit: Leaving...]
jurassic_ has joined #ruby
josefrichter has joined #ruby
SCommette has quit [Quit: SCommette]
mercwithamouth has quit [Ping timeout: 240 seconds]
<awkwords>
hi guys, i have some academic stuff im working on
<breakingthings>
quarters_needed = total / quarter; dimes_needed = total / dime; nickels_needed = total / nickel; pennies_needed = total / penny;
<breakingthings>
and in more detail,
<breakingthings>
quarters_needed = 50 / 25;
<breakingthings>
50 / 25 = 2
<breakingthings>
2 quarters are needed to reach 50
<mercwithamouth>
o_O
<breakingthings>
???? magic
tomsthumb has quit [Read error: Connection timed out]
spaz76 has joined #ruby
rezzack has quit [Ping timeout: 248 seconds]
tomsthumb has joined #ruby
Hanmac1 has quit [Ping timeout: 252 seconds]
nga4 has quit []
superninkendo has joined #ruby
w400z has joined #ruby
Targen has quit [Ping timeout: 264 seconds]
ner0x has joined #ruby
bigoldrock has joined #ruby
sleetdrop has quit [Ping timeout: 248 seconds]
mattbl has quit [Quit: This computer has gone to sleep]
ryanf_ is now known as ryanf
sleetdrop has joined #ruby
wmoxam has quit [Ping timeout: 264 seconds]
v0n has joined #ruby
<lewix>
dont break things
jgrevich has joined #ruby
shevy has joined #ruby
jimeh has quit [Quit: Computer has gone to sleep.]
gchristensen has joined #ruby
Pochacco has joined #ruby
averiso has joined #ruby
d2dchat has quit [Remote host closed the connection]
h4mz1d has quit [Ping timeout: 246 seconds]
<gchristensen>
hi, I'm trying to use require_relative, but I'm getting a LoadError, saying it cannot infer basepath: https://gist.github.com/grahamc/ea1ab1d3b5a3f9bf388a line five being require_relative 'lib/foobar/about'
mattbl has joined #ruby
v0n has quit [Ping timeout: 245 seconds]
<Pochacco>
Can someone tell me what the = sign does inside the function parameter
forced_request has quit [Read error: Connection reset by peer]
gabrielrotbart has quit [Remote host closed the connection]
<waxjar>
Pochacco: assign a default value to an argument
<bnagy>
gchristensen: it doesn't work in irb
tobyo has joined #ruby
<Pochacco>
ty
jpfuentes2 has joined #ruby
finishingmove has joined #ruby
<gchristensen>
bnagy: wht doesn't work in irb?
<gchristensen>
bnagy: I got this error when running `bundle install
alainus is now known as alainus[-_-]
mmitchell has quit [Remote host closed the connection]
Guest53570 has quit [Ping timeout: 255 seconds]
gabrielrotbart has joined #ruby
josefrichter has quit [Quit: josefrichter]
bean has joined #ruby
io_syl has quit [Ping timeout: 248 seconds]
joofsh has quit [Remote host closed the connection]
havenwood has joined #ruby
jgrevich has quit [Read error: No route to host]
hadees has joined #ruby
jdunck has quit [Quit: Computer has gone to sleep.]
<breakingthings>
Can one initialize an object from a method other than 'new'?
MehLaptop has quit [Remote host closed the connection]
<Nom->
breakingthings: You can write class methods that do instantiation.. but generally they'll get an object from new and then do something else with it
<breakingthings>
Nom-: as in, a self.meth that calls self.new? Or something like that, I'm not wholly sure I grasp static methods in ruby.
<Nom->
Yep
daniel_hinojosa has joined #ruby
<breakingthings>
That does make sense I suppose.
<breakingthings>
Thanks.
<breakingthings>
On that same note, I guess, do you think it would be strange to do so; here's an example of what I'm thinking:
<Nom->
I've done it in a few places... particularly in FFI code which wraps a C Library
<breakingthings>
I have a Message class for an irc bot (yay learning exercises), that I expect to mostly use by sending it a line to parse into it's structure
<breakingthings>
I was thinking it makes sense to do Message.parse("some line") as opposed to Message.new("some line")
reset has quit [Ping timeout: 245 seconds]
<Nom->
Although the other way you can do it is by passing a hash to #new and change logic based on which keys are present
brandon has joined #ruby
brandon is now known as Guest70829
<breakingthings>
Hmm… That would seem strange in this case… Message.new { parse: line }
jamie_ca_ has joined #ruby
<breakingthings>
Thing is I don't really know that I'll have any other use than parse here
akashj87__ has quit [Quit: leaving]
<breakingthings>
I could probably get away with just having an optional argument in initialize that would do the same thing as parse
<Nom->
You could look at extract_options!
twoism has joined #ruby
<breakingthings>
so I guess it comes down to, as a matter of personal preference would you rather:
bubblehead has quit [Remote host closed the connection]
<breakingthings>
Well, I'm not using ActiveSupport...
<Nom->
That function is about 3 lines of Ruby from memory :)
<breakingthings>
But even so I just don't know that I would need that functionality
<havenwood>
breakingthings: How bout: Message.call line
<breakingthings>
havenwood: what's the logic behind call?
<havenwood>
breakingthings: Is it parsing?
<breakingthings>
It would be parsing a line into a Message object
<havenwood>
breakingthings: If you end up refactoring, #call lends itself to being proc'ifyed
<havenwood>
breakingthings: Message.read or Message.get, how would you say it in English?
<breakingthings>
Mmm… neither.
<havenwood>
breakingthings: My vote: Message.nomnom
<breakingthings>
Or maybe, I dunno.
* breakingthings
is confuse
tewlz has quit [Quit: Lost terminal]
jamie_ca_ has quit [Quit: Computer has gone to sleep.]
<breakingthings>
havenwood: 10/10 nobel peace prize for solving this problem, who knows what north korea might have done if we waited another few minutes
tylersmith has joined #ruby
<havenwood>
breakingthings: get/put, parse/dump, read/write <- all those frequently
<breakingthings>
I feel parse is closest
<havenwood>
s/all/i seem to see
jetblack has quit [Remote host closed the connection]
idkazuma has quit [Remote host closed the connection]
<breakingthings>
but again it was more of is it common to see a method like this that is an alternate instantiation, or would it be more rubby-like to have an alternate way for #new to provide this functionality
macmartine has joined #ruby
<breakingthings>
Message.new "this line would be parsed" vs. the more explicitly read Message.parse "this line would be parsed"
<havenwood>
breakingthings: We're talking about a module, not a class, right?
<breakingthings>
A class
maletor has joined #ruby
jetblack has joined #ruby
<breakingthings>
Message would have properties, such as :sender :target :command, etc
statix_ has quit [Read error: Connection reset by peer]
<amh345>
anyone know if net-ssh supports multi factor authentication?
instinkt has quit [Read error: Connection reset by peer]
<breakingthings>
Message.parse "some raw message" would create a new Message object with these properties parsed from the raw message
stat1x has joined #ruby
alvaro_o has quit [Quit: Ex-Chat]
ikea_meatballs has joined #ruby
<havenwood>
breakingthings: If you use Message.parse, use a module with `class << self` rather than a class. If you don't need to instantiate, better to use a module. Actually, even if you want to use `new`, still use a module self.method rather than class--again, unless you need instantiation.
brianpWins has joined #ruby
chriskk has quit [Quit: chriskk]
* breakingthings
hits itself in confusion!
mmitchell has joined #ruby
<havenwood>
breakingthings: Basically, it is fine to: module MyModule; def self.new; 'hi' end end
rburton- has quit [Quit: Leaving...]
<breakingthings>
right, I know
ikea_meatballs is now known as Not_Ikea_Meatbal
<breakingthings>
Oooooh
v0n has joined #ruby
<breakingthings>
So, instead of having a class that has these methods and creates an instance
<breakingthings>
Instead, have a module that has a parse method that simply… I guess, creates a Struct and returns that?
akashj87 has joined #ruby
mephux has quit [Excess Flood]
Vert has quit [Read error: Connection reset by peer]
* breakingthings
is quite confused
mmitchell has quit [Ping timeout: 240 seconds]
kofno has joined #ruby
mephux has joined #ruby
45PAAAP98 has joined #ruby
jeremywrowe has quit [Ping timeout: 245 seconds]
Opettaja has quit [Quit: WeeChat 0.4.0]
Vert has joined #ruby
45PAAAP98 has quit [Remote host closed the connection]
idkazuma has joined #ruby
idkazuma has quit [Read error: Connection reset by peer]
tcopp has quit [Ping timeout: 245 seconds]
idkazuma has joined #ruby
havenwood has quit [Remote host closed the connection]
havenwood has joined #ruby
kofno has quit [Ping timeout: 248 seconds]
<Inside>
bog.
<Inside>
how is '\\\''.length = 2
mattbl has quit [Quit: This computer has gone to sleep]
<gchristensen>
Inside: the \ is an escape character, so \\ becomes a literal \, and \' becomes a literal '
<Inside>
yessh.. but the string is equal to "\\'"
<gchristensen>
Inside: >> puts '\\\''
<gchristensen>
\'
<Inside>
hrnhrn
<Inside>
irb(main):099:0> f = '\\\''
<Inside>
=> "\\'"
<gchristensen>
when it sends it back to you its quoting it again so its valid Ruby
<Inside>
ahhh I see.
<gchristensen>
s/quoting/escaping/
macmartine has quit [Quit: Computer has gone to sleep.]
havenwood has quit [Ping timeout: 245 seconds]
<gchristensen>
Inside: and since its using double-quotes, it doesn't need to escape the '
<Inside>
I see. makes a lot more sense now, thanks
<gchristensen>
you're welcome
mattbl has joined #ruby
rupee has quit [Quit: Leaving]
twoism has quit [Remote host closed the connection]
<dawkirst>
silly question: is it okay to require gems in a class definition (or is it *supposed* to be required there)?
tomsthumb has quit [Read error: Connection reset by peer]
bubblehead has joined #ruby
<gestahlt>
bnagy: can root have a value?
brhelwig has quit [Remote host closed the connection]
<bnagy>
dawkirst: _usually_ requires are at the top of the file
<bnagy>
but that's probably because usually people try to stick with one class / module per file
<dawkirst>
bnagy, makes a lot of sense, thanks
<bnagy>
you can require anywhere you want, though
Al_ has joined #ruby
tomsthumb has joined #ruby
osvico has quit [Ping timeout: 256 seconds]
<bnagy>
gestahlt: root does have a value, there - it's value is the hash {a: {b: 1, c: 2}}
<bnagy>
*its
Cork has quit [Read error: Operation timed out]
<bnagy>
stupid fingers
<gestahlt>
bnagy: Ah this one is also a good question. Is it good "ruby practice" to stick with one class / module per file? Im used to have several classes in one file in my VB days. When i wrote librarys that were shared accross my software i had several classes in one file. Seems uncommon in ruby tho
mattbl has quit [Quit: This computer has gone to sleep]
<bnagy>
most people do
Cork has joined #ruby
<gestahlt>
bnagy: Yes, but can root have another value beside the hash?
<gestahlt>
bnagy: See the gist
hamed_r has quit [Quit: Leaving]
<bnagy>
a hash is a key value store, one key, one value
<bnagy>
but the value can be another hash, or an array, or a collection of pithy swedish haiku
<gestahlt>
bnagy: Ah right.. so i have to store duplicate information to achieve my goal? I want to create a disk layout file, preferably in yaml. I need to use it as a config file and read it later again, so it must be easy to parse
pi3r has joined #ruby
<bnagy>
that gist looks like it's already valid yaml
atmosx has joined #ruby
<Hanmac>
dawkirst: i also require stuff inside my methods so its only require when you really need it
ephemerian has joined #ruby
nari has quit [Ping timeout: 245 seconds]
<gestahlt>
bnagy: Yeah it should be. I just need to create a yaml in this style. I thought the right way to do it is with nested hashes. The information for the content i already got
anderse has quit [Quit: anderse]
afei has joined #ruby
daniel_- has joined #ruby
rdark has joined #ruby
afei has quit [Quit: ERC Version 5.3 (IRC client for Emacs)]
k610 has joined #ruby
afei has joined #ruby
emergion has joined #ruby
ukd1 has quit [Ping timeout: 248 seconds]
nga4 has joined #ruby
ukd1 has joined #ruby
sayan has joined #ruby
wargasm1 has quit [Ping timeout: 264 seconds]
mikewintermute has quit [Quit: mikewintermute]
chussenot has joined #ruby
mikewintermute has joined #ruby
bubblehead has quit [Ping timeout: 264 seconds]
icole has quit [Remote host closed the connection]
wargasm has joined #ruby
Guest80121 is now known as UukGoblin
jaygen_ has joined #ruby
<Fallacy>
What does '\\1' do in gsub?
jaygen has quit [Read error: Operation timed out]
<Hanmac>
Fallacy: $1
<Hanmac>
its the first group of regexmatch
nari has joined #ruby
arya has quit [Ping timeout: 248 seconds]
maxmanders has joined #ruby
maxmande_ has joined #ruby
arya has joined #ruby
akashj87 has quit [Quit: leaving]
mattbl has joined #ruby
mengu_ has joined #ruby
maxmanders has quit [Ping timeout: 264 seconds]
adambeynon has joined #ruby
afei has left #ruby ["ERC Version 5.3 (IRC client for Emacs)"]
peta_ has joined #ruby
<peta_>
hi guys
daniel_- has quit [Ping timeout: 264 seconds]
Skofo has quit [Ping timeout: 256 seconds]
<peta_>
stupid question … I use a module X with an overly long name. Everything I use a class of it I have to type MyLongModuleName::MyClass … is there a way to skip the module name?
mattbl has quit [Client Quit]
<peta_>
I am aware of potential pitfalls when multiple modules with same class names are around
threesome has joined #ruby
emergion has quit [Quit: Computer has gone to sleep.]
nomenkun has joined #ruby
brhelwig has joined #ruby
HashNuke has joined #ruby
<HashNuke>
hey all
<bnagy>
include MySuparLongThing
io_syl has quit [Quit: Computer has gone to sleep.]
<HashNuke>
How do I connect to bluetooth devices in Ruby? (I only need discover other bluetooth devices that are active).
<bnagy>
probably the same way you would do it in any HLL
<bnagy>
script a commandline utility and parse the output, or wrap a native lib
<HashNuke>
I've been looking the Socket class (assuming that's where I should be looking)
drale2k has quit [Quit: Leaving...]
<Hanmac>
peta_ you could asign your module into another constant
peta_ has quit [Remote host closed the connection]
jimeh has quit [Quit: Bye.]
peta_ has joined #ruby
reactormonk has quit [Ping timeout: 272 seconds]
idkazuma has joined #ruby
jimeh has joined #ruby
<peta_>
bnagy: thx. will this have any negative sideeffects in terms of performance/memory consumption?
sayan has quit [Read error: Connection reset by peer]
<bnagy>
uh... no, for sane values of 'any'
angusiguess has joined #ruby
nomenkun_ has joined #ruby
nomenkun has quit [Ping timeout: 246 seconds]
icole has joined #ruby
angusiguess has quit [Ping timeout: 264 seconds]
arya has quit [Ping timeout: 248 seconds]
<peta_>
ok sir
<peta_>
:)
<peta_>
And what will happen when two classes with the same name collide? Will the one defined last have precedence?
buscon has joined #ruby
br4ndon has joined #ruby
ukd1 has quit [Remote host closed the connection]
crazed has quit [Ping timeout: 240 seconds]
ARCADIVS has quit [Quit: WeeChat 0.3.8]
ukd1 has joined #ruby
HashNuke has quit [Quit: Computer has gone to sleep.]
srm` has quit [Quit: WeeChat 0.4.0-dev]
arya has joined #ruby
mikurubeam has quit [Ping timeout: 252 seconds]
reactormonk has joined #ruby
hbpoison has joined #ruby
Faris6 has joined #ruby
josefrichter_ has joined #ruby
emergion has joined #ruby
kofno has joined #ruby
grier has quit [Ping timeout: 276 seconds]
grier has joined #ruby
crazed has joined #ruby
mikewintermute has quit [Quit: mikewintermute]
kofno has quit [Ping timeout: 248 seconds]
HashNuke has joined #ruby
timonv has joined #ruby
arya has quit [Ping timeout: 248 seconds]
elaptics`away is now known as elaptics
slainer68 has joined #ruby
idkazuma has quit [Remote host closed the connection]
giabboo has joined #ruby
swistak35 has quit [Ping timeout: 264 seconds]
<giabboo>
hi guys and girls
<giabboo>
im getting this error when i try to start a ruby app
<giabboo>
/usr/lib/ruby/site_ruby/1.8/puppet/agent.rb:89:in `exit': no implicit conversion from nil to integer (TypeError)
duosrx has joined #ruby
arya has joined #ruby
<Hanmac>
giabboo: gist us your code what you did
<giabboo>
it's not my app =)
<giabboo>
maybe i better ask on puppet channel
apeiros_ has joined #ruby
jprovazn has joined #ruby
burgestrand has joined #ruby
crazed has quit [Ping timeout: 264 seconds]
burgestrand has quit [Client Quit]
burgestrand has joined #ruby
hbpoison has quit [Ping timeout: 248 seconds]
dhruvasagar has quit [Ping timeout: 256 seconds]
anirudh24seven has quit [Ping timeout: 252 seconds]
atno has joined #ruby
dhruvasagar has joined #ruby
Mattx has joined #ruby
timmow has joined #ruby
anirudh24seven has joined #ruby
h8R has joined #ruby
Matip has quit [Ping timeout: 240 seconds]
atmosx has quit [Quit: And so the story goes…]
emergion has quit [Quit: Computer has gone to sleep.]
miso1337 has quit [Quit: afk]
Zai00 has joined #ruby
jaygen has joined #ruby
cantonic has joined #ruby
jaygen_ has quit [Read error: Operation timed out]
DonRichie has joined #ruby
witchdoc has quit [Quit: bye]
<giabboo>
nobody can help me there
<giabboo>
Hanmac this is the line the error is related to
cobragoat has quit [Remote host closed the connection]
<giabboo>
exit(yield)
cobragoat has joined #ruby
hashmal has joined #ruby
ismell has quit [Quit: Lost terminal]
<razibog>
giabboo: i googled and this seems like a good and appropriate answer: Your error is coming from the C code inside the Ruby interpreter. A core class, implemented in C, is being handed a nil when it expects an Integer. It may have a #to_i but it doesn't have a#to_int and so the result is the TypeError.
<razibog>
may be that yield expects an int, but gets a nil, and can't convert
ukd1 has quit [Remote host closed the connection]
<giabboo>
so it's a code bug
<Hanmac>
giabboo how do you use puppet?
<giabboo>
i'm using in a test environment at the moment
<giabboo>
but it was working fine i guess before a system update
<bnagy>
so exit yield wants to exit with a status code
<giabboo>
i'm running CentOS
<bnagy>
but the block that's being provided to that method is returning nil I guess
<giabboo>
i wanna do some clean in the puppet certificates
<giabboo>
and see if this will fix the issue wait
peta_ has left #ruby [#ruby]
nga4 has quit [Ping timeout: 245 seconds]
banister`sleep has quit [Ping timeout: 246 seconds]
tonini has quit [Remote host closed the connection]
<Gadgetoid>
Hanmac: That's the sort of information I'm after, thanks, just not in a pretty enough format. Fix incoming.
maxmande_ has quit [Ping timeout: 245 seconds]
maxmande_ has joined #ruby
skattyadz has quit [Quit: skattyadz]
sleetdrop has quit [Ping timeout: 245 seconds]
Gruu_ has quit [Quit: Gruu_]
yshh has quit [Remote host closed the connection]
robustus|Off has joined #ruby
casheew has quit [Read error: Connection reset by peer]
robustus has quit [Ping timeout: 276 seconds]
casheew has joined #ruby
hbpoison has joined #ruby
love_color_text has joined #ruby
Faris7 has joined #ruby
bluOxigen has joined #ruby
Faris6 has quit [Ping timeout: 264 seconds]
hamakn has quit [Remote host closed the connection]
<BadQuanta>
Can someone point me to an explanation as to why the search path/load path of ruby requires statements never check the directory the file the require is declared in?
hbpoison has quit [Ping timeout: 245 seconds]
<BadQuanta>
It just seems off to me to have to do: require File.expand_path() at all.
br4ndon has quit [Quit: Lorem ipsum dolor sit amet]
casheew has quit [Read error: Connection reset by peer]
<BadQuanta>
Considering how OFTEN this is done, and the fact that autoload isn't any smarter out of the box, I just don't get it.
casheew has joined #ruby
<BadQuanta>
It'd be cool if I could give autoload relative paths from the current __FILE__.
kofno has joined #ruby
<BadQuanta>
And I'm tempted to overload the method to do just that (by looking for requires that start with ./ and ignoring all the other ones.)
ph^ has quit [Ping timeout: 246 seconds]
<Hanmac>
BadQuanta: because its a security leak
<Gadgetoid>
BadQuanta: I just do require './becauseimlazy.rb'
hamakn has joined #ruby
<BadQuanta>
./ isn't working for me.
<Hanmac>
Gadgetoid: this is a security leak too
<BadQuanta>
Hanmac: I kinda get that argument already. I thought about that. But if I'm including code in that directory, can I not trust that directory at all?
<charliesome>
BadQuanta: File.expand_path is ok
<lupine>
OK, I have a DL::Ptr to a wchar_t - is there a way I can convert this into a Ruby string without needing to wrap and call wcslen myself?
<charliesome>
but ./ is not becasue it relies on the current directory
<lupine>
(I have to use DL, FFI isn't an option, unfortunately)
<BadQuanta>
charliesome, Yeah.
icole has quit [Remote host closed the connection]
<BadQuanta>
Can someone explain to me in more detail why it's a security issue?
<charliesome>
check out require_relative
<charliesome>
BadQuanta: say you have a setuid ruby program
<Hanmac>
BadQuanta: if some function changes the current directory, then your require may point to bad and evil files
<charliesome>
if you use ./ then i can elevate my own privileges by starting that program in another directory
<lupine>
BadQuanta, it ups a file writing vulnerability to a code execution vulnerability
<BadQuanta>
True.
<charliesome>
that has my evil file in it
<BadQuanta>
But is that not true of all of my ruby directories?
<charliesome>
BadQuanta: not necessarily
<BadQuanta>
This is something that is packaged as a gem.
<lupine>
it's just a general hygiene thing
<BadQuanta>
My gem lives where all the other gems live.
<charliesome>
BadQuanta: maybe the gem is installed by root, owned by root, all the files are owned by root
<Gadgetoid>
If my code has been compromised then it might lead to my code being compromised?
amaya_the has quit [Read error: Connection reset by peer]
<lupine>
BadQuanta, in gems, you can't guess where you're going to end up being installed, and how your files are going to be arranged
<lupine>
assume your load path has been set up correctly, and for the love of god, don't mess with it
<BadQuanta>
Well, so far you guys haven't really convinced me it is a credible threat. I mean, yes it is possible, but I don't see how that attack vector is different from simply modifying some other ruby file someone knows I require.
statarb3 has joined #ruby
statarb3 has quit [Changing host]
statarb3 has joined #ruby
casheew has quit [Read error: Connection reset by peer]
<BadQuanta>
And here is my logic for local directory as FIRST loadpath location check: 1) It is intuitive for programmers and saves typing. 2) If I have that ruby file in my local directory, I probably meant to load that and NOT the system install of that file.
thone has joined #ruby
<BadQuanta>
Dunno... just how I look at it.
<Hanmac>
BadQuanta: because gems are often installed with root rights, so the files can only be changed with root rights too, but if there is some local file interfering than then you have problems
<BadQuanta>
I'm talking about __FILE__ local.. not CWD local.
<BadQuanta>
So local would have to be in the root-only gem directory.
vlad_starkov has joined #ruby
<BadQuanta>
I'm saying, check the directory the __FILE__ is located in, not current working directory.
wmoxam has joined #ruby
<BadQuanta>
Or perhaps you knew that already and I misunderstood your reply.
<BadQuanta>
And BTW, I'm fine with RTFM if someone can point me in the right direction if there is already a thorough explanation. Perhaps there is a mailing list post?
cha1tanya has joined #ruby
cha1tanya has quit [Changing host]
cha1tanya has joined #ruby
<BadQuanta>
I've googled but couldn't find it.
<BadQuanta>
I've searched google groups for the ruby chats too.
<Hanmac>
BadQuanta: for short: dont mess with the loadpath, dont write 1.8 only stuff, and throw your 1.8ruby away its outdated
thone_ has quit [Ping timeout: 240 seconds]
<BadQuanta>
Ok. I'm writing 1.9.3, so why is it significant that I throw away 1.8?
<BadQuanta>
Is there something I don't know about 1.9 or 2 that fixes what I'm complaining about?
dayepa1 has quit [Quit: dayepa1]
atno has joined #ruby
dayepa_ has quit [Quit: 전 이만 갑니다.]
atno has quit [Remote host closed the connection]
nari has joined #ruby
<BadQuanta>
Anywho.. I've had my rant and I appreciate the response. I do get the security threat, perhaps not deeply enough to respect it, but from my point of view it is not worth the programmer aggravation/agitation?
casheew has joined #ruby
* Gadgetoid
adds require_local into his pryrc
<BadQuanta>
Thanks guys. :)
<Hanmac>
BadQuanta: 1.8 will not get any support anymore in a few months
<apeiros_>
it is faster than pushing individual elements, it is also faster than push(*ary)
<lupine>
concat() returns a new array, doesn't it?
<apeiros_>
lupine: no
<apeiros_>
and even if it would, that doesn't mean it'd be slower
<lupine>
ah, so it doesn't. silly memory
jjbohn has joined #ruby
browndawg has joined #ruby
<lupine>
yes, concat is better, then
sayan has joined #ruby
tonini has joined #ruby
wmoxam has quit [Ping timeout: 245 seconds]
ph^ has quit [Ping timeout: 264 seconds]
hbpoison has joined #ruby
geekbri has joined #ruby
icole has joined #ruby
jeremywrowe has quit [Ping timeout: 246 seconds]
sayan has quit [Max SendQ exceeded]
Catbuntu has joined #ruby
sayan has joined #ruby
divout has quit [Remote host closed the connection]
idealhack has joined #ruby
krawchyk has joined #ruby
pavilionXP has joined #ruby
hbpoison has quit [Ping timeout: 245 seconds]
icole has quit [Ping timeout: 264 seconds]
sayan has quit [Max SendQ exceeded]
Morrolan has quit [Ping timeout: 252 seconds]
sayan has joined #ruby
slainer68 has joined #ruby
Morrolan has joined #ruby
banister`sleep has quit [Read error: Connection reset by peer]
banister`sleep has joined #ruby
sayan has quit [Max SendQ exceeded]
rdark has quit [Ping timeout: 245 seconds]
sayan has joined #ruby
ananthakumaran has quit [Quit: Leaving.]
rdark has joined #ruby
sayan has quit [Max SendQ exceeded]
Sicp has quit [Ping timeout: 246 seconds]
<ericwood>
>> puts "hi"
<ericwood>
> puts "hi"
joofsh has quit [Remote host closed the connection]
<Mon_Ouie>
eval-in isn't here ;)
<ericwood>
:(
hashmal has quit [Ping timeout: 264 seconds]
* lupine
is *almost there* with his winapi call
<lupine>
5 hours is far too much time
mljsimone has joined #ruby
gyre007 has quit [Ping timeout: 252 seconds]
solidoodlesuppor has joined #ruby
br4ndon has joined #ruby
duosrx has quit [Remote host closed the connection]
etcetera has joined #ruby
Mon_Ouie has quit [Ping timeout: 240 seconds]
gyre007 has joined #ruby
gyre007 has quit [Max SendQ exceeded]
kosai03 has joined #ruby
gyre007 has joined #ruby
etcetera has quit [Client Quit]
tommyvyo has joined #ruby
kosai03 has quit [Client Quit]
jjbohn is now known as jjbohn|afk
TooTubular has joined #ruby
Spooner_ has joined #ruby
NiteRain has quit [Ping timeout: 246 seconds]
dEPy has joined #ruby
sleetdrop has joined #ruby
yeltzooo6 has quit [K-Lined]
josefrichter has joined #ruby
hamakn has quit [Remote host closed the connection]
jgarvey has joined #ruby
xpen has joined #ruby
jjbohn|afk is now known as jjbohn
hamakn has joined #ruby
_veer has quit [Ping timeout: 248 seconds]
popapusha has joined #ruby
rudisimo has joined #ruby
xpen has quit [Remote host closed the connection]
_carloslopes has joined #ruby
xpen has joined #ruby
yeltzooo has joined #ruby
hydrozen has joined #ruby
carloslopes has quit [Ping timeout: 248 seconds]
<popapusha>
http://pastebin.com/9fDSC6Lz <-- can someone help me understand this ruby function.. im trying to rewrite it in python but its not going so well :/
amaya_the has quit [Quit: ChatZilla 0.9.89 [Firefox 19.0.2/20130307023931]]
m8 has joined #ruby
sayan has joined #ruby
br4ndon has quit [Quit: Lorem ipsum dolor sit amet]
<popapusha>
so say i have foo = bar.slice!(0, 4) would that set foo to the first 4 characters of bar and cut off the first 4 chars of bar?
sayan has quit [Max SendQ exceeded]
hiyakashi has joined #ruby
<gchristensen>
popapusha: why don't you open up irb and try it out?
g4mm4 has quit [Remote host closed the connection]
jlast has joined #ruby
<popapusha>
well thats an option but the pc im on doesnt have ruby installed.. i can install it but i was already on irc so i thought id ask the simple question
v0n has joined #ruby
justsee has quit [Ping timeout: 240 seconds]
tcopp has joined #ruby
tonini has quit [Remote host closed the connection]
breakingthings has joined #ruby
_nitti has joined #ruby
jpfuentes2 has joined #ruby
adkron has joined #ruby
baba has quit [Ping timeout: 264 seconds]
tonini has joined #ruby
<Hanmac>
popapusha: the ruby code is also evil because it changes the parameterstring
<popapusha>
ok thats what i think through me off
hogeo has quit [Remote host closed the connection]
averiso has joined #ruby
v0n has quit [Ping timeout: 252 seconds]
tonini has quit [Remote host closed the connection]
wmoxam has joined #ruby
<popapusha>
so if bar = "abcdefg" and i had foo = bar.slice!(0, 4) foo would eq abcd and then bar would become = "efg"?
m8 has quit [Quit: Sto andando via]
duosrx has joined #ruby
sambio has joined #ruby
<Hanmac>
yep
pothibo has joined #ruby
<popapusha>
ok thank you
polymar has joined #ruby
baba has joined #ruby
<Hanmac>
about the % 4 while loop ... it chould be better with this: slen += 3 - (slen - 1) % 4
<popapusha>
this is where i like ruby better than python.. python will require me to set a new var to modify the str
wmoxam has quit [Ping timeout: 264 seconds]
Goles has quit [Quit: Computer has gone to sleep.]
mmitchell has joined #ruby
<popapusha>
ah i see it would be faster that way
<dEPy>
any1 here involved in a startup?
sleetdrop has quit [Ping timeout: 252 seconds]
sleetdrop has joined #ruby
jjbohn has quit [Quit: Leaving...]
nga4 has joined #ruby
clocKwize has quit [Quit: clocKwize]
lewix has joined #ruby
cha1tanya has quit [Quit: Leaving]
EPIK has quit [Ping timeout: 264 seconds]
huoxito has joined #ruby
cmarques has joined #ruby
apeiros_ has quit [Remote host closed the connection]
clocKwize has joined #ruby
dhruvasagar has joined #ruby
binaryplease has joined #ruby
sailias has joined #ruby
Coolhand has quit [Remote host closed the connection]
duosrx has quit [Ping timeout: 272 seconds]
hbpoison has joined #ruby
kpshek has joined #ruby
atno has joined #ruby
polymar_ has joined #ruby
ananthakumaran has joined #ruby
ananthakumaran has quit [Max SendQ exceeded]
_maes_ has joined #ruby
banister`sleep has quit [Remote host closed the connection]
ananthakumaran has joined #ruby
love_color_text has quit [Remote host closed the connection]
polymar has quit [Ping timeout: 264 seconds]
osvico has joined #ruby
hbpoison has quit [Ping timeout: 240 seconds]
polymar_ has quit [Ping timeout: 256 seconds]
sie has joined #ruby
supergiantrobot has quit [Quit: supergiantrobot]
duosrx has joined #ruby
mmitchel_ has joined #ruby
ferdev has joined #ruby
tonini has joined #ruby
Banistergalaxy has joined #ruby
polymar has joined #ruby
Coolhand has joined #ruby
mattbl has joined #ruby
krawchyk has quit [Remote host closed the connection]
mmitchell has quit [Ping timeout: 272 seconds]
gaahrdner has joined #ruby
alainus[-_-] is now known as alainus
casheew has quit [Read error: Connection reset by peer]
casheew has joined #ruby
alainus has left #ruby ["Leaving"]
jtharris has joined #ruby
tcopp has quit [Ping timeout: 256 seconds]
mattbl has quit [Client Quit]
krawchyk has joined #ruby
TeckniX has joined #ruby
casheew has quit [Read error: Connection reset by peer]
<TeckniX>
Hello - I've been trying to use RBEnv to install / manage different ruby versions on my mac and keep getting errors of missing iconv libs - Anyone seen this?
krawchyk has quit [Remote host closed the connection]
casheew has joined #ruby
joofsh has joined #ruby
krawchyk has joined #ruby
mellow has joined #ruby
<mellow>
hi
nathanl_ has joined #ruby
stevechiagozie has joined #ruby
razibog has joined #ruby
Abhijit has joined #ruby
<Abhijit>
hi guys. rails server is not doing anything on my suse 12.2 and printing --help content instead
chussenot has joined #ruby
yshh has joined #ruby
ssms has joined #ruby
adkron has quit [Ping timeout: 252 seconds]
<Abhijit>
hi guys. rails server is not doing anything on my suse 12.2 and printing --help content insteadthe command 'rails server'
<Abhijit>
the command 'rails server'
tobyo has joined #ruby
phantasm66 has joined #ruby
phantasm66 has quit [Changing host]
phantasm66 has joined #ruby
NiteRain has joined #ruby
failshell has joined #ruby
mephux has quit [Excess Flood]
casheew has quit [Read error: Connection reset by peer]
casheew has joined #ruby
buibex has joined #ruby
willob has joined #ruby
<Spooner_>
Abhijit, Ask in #rubyonrails
frem has joined #ruby
mephux has joined #ruby
Schmidt has quit [Ping timeout: 255 seconds]
generalissimo has joined #ruby
bigoldrock has quit [Ping timeout: 264 seconds]
lewix has quit [Remote host closed the connection]
slainer68 has quit [Remote host closed the connection]
bluOxigen has quit [Remote host closed the connection]
bluOxigen has joined #ruby
slainer68 has joined #ruby
timonv has quit [Remote host closed the connection]
nathanl_ is now known as nathan
hashmal has joined #ruby
nathan is now known as nathanlil13
jprovazn has quit [Quit: Leaving]
lewix has joined #ruby
<mellow>
hi
<mellow>
if I have a socket
interactionjaxsn has joined #ruby
<mellow>
and open the connection with transport = @conn.accept
ferdev has quit [Quit: ferdev]
<mellow>
and then pass the socket to a method
<mellow>
can I loop while getting data until the conection closes?
<Spooner_>
Which socket? There are server sockets and client sockets.
<mellow>
sorry, server
<mellow>
@conn = TCPServer.new('localhost',port)
nathanlil13 has quit [Quit: leaving]
timonv has joined #ruby
<Spooner_>
Yes, transport will be a client socket which you can read from. While doing that, you can accept a new connection from the server socket if you want.
<Spooner_>
The client can be treated as any other stream really.
dmiller has joined #ruby
mikurubeam has joined #ruby
<mellow>
I see, I only want one connection per time, so I'm not creating new theards
<mellow>
thanks!
tonini has quit [Remote host closed the connection]
<Spooner_>
OK.
Abhijit has quit [Quit: Leaving]
atno has quit [Remote host closed the connection]
peta_ has joined #ruby
<mellow>
one more thing, I should iterate until the socket has closed, so would this be good enough? while @conn ...
<Spooner_>
No, because @conn will always be truthy since it is an object.
nathanl has joined #ruby
Loaft has joined #ruby
* nathanl
sonda has quit [Remote host closed the connection]
<breakingthings>
mellow: while line = @conn.readline or similar.
Davey has joined #ruby
tobyo has quit [Quit: WeeChat 0.3.2]
forrest has joined #ruby
ffranz has joined #ruby
<mellow>
Oh i got confused, thought that readline would send false when nothing was sent, but it must work like a gets
<mellow>
thanks
polymar_ has joined #ruby
<breakingthings>
You should test it to be sure, but I think it should work out.
pskosinski has joined #ruby
rhannequin has joined #ruby
hbpoison has joined #ruby
<mellow>
yes I have just tried
<breakingthings>
Socket should throw an EOF error too.
<mellow>
im creating an http proxy server in ruby
SCommette has joined #ruby
<mellow>
just tried it with netcat and its going well, thanks!
pduin has quit [Remote host closed the connection]
polymar has quit [Read error: Connection reset by peer]
banister`sleep has joined #ruby
ferdev has joined #ruby
<lupine>
mellow, there are libraries for that ^^
pduin has joined #ruby
Xeago has joined #ruby
rhannequin has left #ruby [#ruby]
clocKwize has quit [Quit: clocKwize]
anirudh24seven has quit [Ping timeout: 264 seconds]
pduin has quit [Remote host closed the connection]
akashj87 has joined #ruby
<bean>
ah, you want to write your own version of that
<shevy>
nathanl one day I'll finish my old shell, name I gave it was "diamond shell". there are a few things I am unhappy with it, aside from that I must create many more small gems so others could use it. for instance, in bash "ls" is super fast. if you implement ls in ruby (like via Dir['*']), it is much slower, especially for many files, at least that was my impression so far with it :(
buscon has quit [Quit: Leaving]
<shevy>
s/large files / large, many files/
<mellow>
yes
<mellow>
I want to be the socks server
<mellow>
that allows you to proxy thorugh the socks server
<shevy>
hehe
<shevy>
always have to think of a pair of socks ...
<gestahlt>
Ah, is there a method to do somethign like this: "mystring".method :mystring?
banisterfiend has joined #ruby
<Spooner_>
It is mainly used to convert from class name (camel-case) to and from file name (snake-case).
<shevy>
what method is that gestahlt?
k610 has quit [Quit: Leaving]
<Spooner_>
Do you mean "mystring".to_sym #=> :mystring ?
<gestahlt>
Thats what i am asking. Im building a hash and i need a variable converterted to a symbol.. aw i just answered it myself.. it would be .to_symbol?
<shevy>
ah, symbols
<shevy>
to_sym indeed
Al_ has quit [Ping timeout: 245 seconds]
<shevy>
"mystring".to_sym # => :mystring
<Spooner_>
Yeah, use #=> to indicate the output. It looked like :mystring was an argument to #method.
xbob has joined #ruby
<shevy>
dunno why it is #to_sym and not #to_symbol
sepp2k has quit [Ping timeout: 240 seconds]
<shevy>
matz hates typing long stuff I think :D
<Hanmac>
gestahlt ... convert to symbol may be a bad way if you dont know what you are doing
<Spooner_>
Yes, like we have to_s and to_str, but not to_string ;)
<Hanmac>
but we have String()
<shevy>
yeah... damn to_str
<shevy>
we have String() method??
includex has joined #ruby
<shevy>
ack
<shevy>
String(:foo) # => "foo"
<Hanmac>
yeah, like we have Array() and Integer()
<Spooner_>
Kernel.String(), just like Array() and Integer()
<shevy>
I only knew about Integer()
<shevy>
cool
<Hanmac>
but for some reason its Hash[] and not Hash()
<shevy>
but ugly
<shevy>
hehe
maxmanders has joined #ruby
BadQuanta has quit [Quit: Leaving]
jonathanwallace has quit [Ping timeout: 245 seconds]
<shevy>
principle of matz's least surprise
<Spooner_>
Hanmac: Because the path of least surprise is a lie (like cake!).
<shevy>
yeah
Uranio has joined #ruby
sie has quit [Ping timeout: 272 seconds]
Nisstyre-laptop has quit [Ping timeout: 272 seconds]
<shevy>
enforcing consistency within a large programming language must be difficult
tommyvyo has quit [Quit:]
<Hanmac>
Spooner_ yeah its the Path of "Wen the Eternally Surprised" :D
<Spooner_>
Yeah, but you'd think things that were inconsistent would get slowly deprecated (like Hash[] to Hash()).
ckrailo has quit [Quit: Computer has gone to sleep.]
pyro111 has quit [Quit: Leaving]
xbob has quit [Client Quit]
sambao21 has joined #ruby
Tricon has joined #ruby
maxmanders has quit [Client Quit]
ckrailo has joined #ruby
i_s has joined #ruby
<shevy>
perhaps in ruby 3.0
ckrailo has quit [Client Quit]
pangur has joined #ruby
threesome has quit [Ping timeout: 245 seconds]
Spooner_ has quit [Remote host closed the connection]
girija has quit [Ping timeout: 256 seconds]
<tobago>
I try to implement a sort method for a Pixel class:https://gist.github.com/trinibago/5255601
peterhellberg has quit [Remote host closed the connection]
<tobago>
but the sort algorithm doesn't work
chussenot has joined #ruby
maxmanders has joined #ruby
brianpWins has joined #ruby
<pangur>
On Mint14, after using rvm to install Ruby 2.0.0, I get the following error message: Error running 'env GEM_PATH=/home/calum/.rvm/gems/ruby-2.0.0-p0:/home/calum/.rvm/gems/ruby-2.0.0-p0@global:/home/calum/.rvm/gems/ruby-2.0.0-p0:/home/calum/.rvm/gems/ruby-2.0.0-p0@global GEM_HOME=/home/calum/.rvm/gems/ruby-2.0.0-p0 /home/calum/.rvm/rubies/ruby-2.0.0-p0/bin/ruby -d /home/calum/.rvm/src/rubygems-2.0.3/setup.rb --verbose'
sepp2k has joined #ruby
etcetera has quit []
<pangur>
Does this mean that I cannot upgrade to 2.0.0
<pangur>
?
<shevy>
ack pangur
<tobago>
how to combine 2 sorts (first sort by x coordinates and then by y coordinates)
jonahR has quit [Quit: jonahR]
Elhu has joined #ruby
etcetera has joined #ruby
<shevy>
pangur no idea, there is #rvm with the experts there. if I were you, I'd try to first see if you can compile ruby 2.0.0 from source (configure + make)
<shevy>
url should be ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.bz2
Yayo has quit [Read error: Connection reset by peer]
TorpedoSkyline has quit [Quit: Computer has gone to… zzzzz...]
<pangur>
OK, thanks for that advice, shevy. I shall trying downloading and compiling. I am not too confident about compiling, that is why I was using rvm! :)
<hoelzro>
x_comparison = x <=> other.x if x_comparison == 0, etc
<hoelzro>
Hanmac: I don't think that will work...
<Hanmac>
yeah i have it wrong
maletor has joined #ruby
moted has joined #ruby
<Hanmac>
(n= y <=> other.y).zero? ? x <=> other.x : n
wmoxam has quit [Ping timeout: 252 seconds]
Yayo has quit [Ping timeout: 245 seconds]
Loaft has joined #ruby
freerobby has joined #ruby
Yayo has joined #ruby
banjara has joined #ruby
kpshek has quit []
Yayo has quit [Read error: Connection reset by peer]
includex has quit [Read error: Connection reset by peer]
twoism has joined #ruby
Yayo has joined #ruby
Lo^18 has joined #ruby
regedarek has quit [Quit: leaving]
dhruvasagar has quit [Ping timeout: 256 seconds]
Lo^18 has quit [Read error: Connection reset by peer]
chussenot has joined #ruby
Lo^15 has joined #ruby
<tobago>
Hanmac, hoelzro: many thanks!!! I only had to change the sort order.
Lo^77 has joined #ruby
Lo^77 has quit [Read error: Connection reset by peer]
tylersmith has joined #ruby
<Hanmac>
tobago: if you have an array of points you can use sort_by {|p| [p.y,p.x]}
Loaft has quit [Ping timeout: 245 seconds]
Lo^50 has joined #ruby
jonahR has joined #ruby
Loaft has joined #ruby
sleetdrop has quit [Ping timeout: 240 seconds]
stef_204 has joined #ruby
<tobago>
Hanmac: I coded a Pixel class for the points to add some methods.
<tobago>
that's why i didn't used an array for keeping the coordinates
Yayo has quit [Ping timeout: 245 seconds]
Yayo has joined #ruby
Lo^03 has joined #ruby
Lo^03 has quit [Read error: Connection reset by peer]
regedarek has joined #ruby
Lo^04 has joined #ruby
maxmanders has quit [Quit: Computer has gone to sleep.]
Lo^15 has quit [Ping timeout: 245 seconds]
Lo^76 has joined #ruby
jurassic_ has joined #ruby
mahoney has joined #ruby
maxmanders has joined #ruby
Lo^48 has joined #ruby
sleetdrop has joined #ruby
Lo^99 has joined #ruby
mattbl has joined #ruby
LennyLinux has joined #ruby
Lo^99 has quit [Read error: Connection reset by peer]
Lo^50 has quit [Ping timeout: 272 seconds]
jnoob22 has joined #ruby
Lo^99 has joined #ruby
marcdel has joined #ruby
Loaft has quit [Ping timeout: 245 seconds]
atno has joined #ruby
atno has quit [Remote host closed the connection]
jdunck has joined #ruby
Yayo has quit [Ping timeout: 240 seconds]
Loaft has joined #ruby
atno has joined #ruby
mattbl has quit [Client Quit]
atno has quit [Remote host closed the connection]
sleetdrop has quit [Client Quit]
etcetera has quit [Ping timeout: 240 seconds]
girija has joined #ruby
mengu_ has joined #ruby
gestahlt has joined #ruby
rupee has joined #ruby
Randomage has quit [Ping timeout: 264 seconds]
ukd1 has joined #ruby
Lo^04 has quit [Ping timeout: 240 seconds]
wmoxam has joined #ruby
Lo^76 has quit [Ping timeout: 245 seconds]
jonathanwallace has joined #ruby
<gestahlt>
Hi, im still stuck at building a nested has. I did this: layout_information = Hash.new and later i tried to layout_information { :disk => { index.to_sym { Hash.new } } } which seems wrong
Lo^48 has quit [Ping timeout: 246 seconds]
<gestahlt>
i get "unexpecteed { expected tASSOC
_nitti_ has quit [Read error: Operation timed out]
<gestahlt>
Whats wrong with that?
_nitti has joined #ruby
etcetera has joined #ruby
<MrZYX>
layout_information = {disk: {index: {}}}, also read up about blocks
Lo^99 has quit [Ping timeout: 245 seconds]
<mahoney>
gestahlt: It seems like you might want "layout_information[:disk] = { ... }" or "layout_information = { :disk => .... }"
<gestahlt>
but index is a variable i used.. will this variable disregarded
renanoronfle has joined #ruby
Al_ has joined #ruby
<gestahlt>
Whats the difference mahoney?
<Hanmac>
gestahlt: it does not work like that
kpshek has joined #ruby
<mahoney>
gestahlt: The first adds :disk to the existing layout_information. The second reinitializes layout_information.
Yayo has quit [Read error: Connection reset by peer]
axl_ has joined #ruby
Yayo has joined #ruby
mockra has joined #ruby
<gestahlt>
mahoney: Kinda. The 0 is the variable "index". and it parents a second hash which also parents another hash
<gestahlt>
Basically a tree
Lo^70 has joined #ruby
joofsh has quit [Remote host closed the connection]
atno has quit [Read error: Connection reset by peer]
<mahoney>
That should work, just use index instead of :0
<LennyLinux>
besides railscasts, can you suggest me some screencasts site, please?
mengu_ has quit [Quit: Konversation terminated!]
atno has joined #ruby
anonymuse has joined #ruby
atno has quit [Remote host closed the connection]
<LennyLinux>
Not necessarily about ruby..
gchristensen has left #ruby ["WeeChat 0.4.0"]
mrsolo has joined #ruby
_carloslopes has joined #ruby
carloslopes has quit [Read error: Connection reset by peer]
atno has joined #ruby
Yayo has quit [Ping timeout: 245 seconds]
hiroyuki has joined #ruby
Lo^70 has quit [Ping timeout: 240 seconds]
hiroyuki has quit [Read error: Connection reset by peer]
Yayo has joined #ruby
wolcanus has quit [Remote host closed the connection]
Yayo has quit [Read error: Connection reset by peer]
Yayo has joined #ruby
maxmanders has quit [Quit: Computer has gone to sleep.]
_nitti_ has joined #ruby
Lo^60 has joined #ruby
atno has quit [Remote host closed the connection]
Lo^60 has quit [Read error: Connection reset by peer]
joofsh has joined #ruby
atno has joined #ruby
Lo^16 has joined #ruby
ij has joined #ruby
ij has quit [Changing host]
ij has joined #ruby
thecreators has quit [Quit: thecreators]
wolcanus has joined #ruby
_nitti has quit [Ping timeout: 245 seconds]
Lo^16 is now known as Loaft
cobragoat has joined #ruby
ij has quit [Client Quit]
Yayo has quit [Ping timeout: 252 seconds]
smigg has joined #ruby
Yayo has joined #ruby
browndawg has quit [Quit: Leaving.]
bricker`LA has quit [Ping timeout: 240 seconds]
brhelwig has quit [Remote host closed the connection]
brhelwig has joined #ruby
browndawg has joined #ruby
Lo^68 has joined #ruby
Lo^68 has quit [Read error: Connection reset by peer]
Lo^37 has joined #ruby
Loaft has quit [Read error: Connection reset by peer]
Loaft has joined #ruby
joofsh has quit [Remote host closed the connection]
ukd1 has quit [Remote host closed the connection]
Vert has joined #ruby
goganchic has joined #ruby
swex_ has joined #ruby
c0rn has joined #ruby
stkowski has joined #ruby
Yayo has quit [Ping timeout: 240 seconds]
maxmanders has joined #ruby
Yayo has joined #ruby
mephux has quit [Excess Flood]
breakingthings has quit []
Lo^37 has quit [Ping timeout: 240 seconds]
mephux has joined #ruby
_nitti_ has quit [Remote host closed the connection]
ukd1 has joined #ruby
tommyvyo has joined #ruby
swex has quit [Ping timeout: 256 seconds]
Loaft has quit [Ping timeout: 256 seconds]
browndawg has left #ruby [#ruby]
slainer68 has quit [Remote host closed the connection]
angusiguess has joined #ruby
browndawg has joined #ruby
p8952 has quit [Ping timeout: 245 seconds]
Yayo has quit [Ping timeout: 252 seconds]
renanoronfle has quit [Quit: This computer has gone to sleep]
moos3 has quit [Quit: Computer has gone to sleep.]
musl has joined #ruby
maxmanders has quit [Quit: Computer has gone to sleep.]
jfelchner1 has quit [Ping timeout: 240 seconds]
musl has quit [Remote host closed the connection]
Yayo has joined #ruby
Yayo has quit [Read error: Connection reset by peer]
musl has joined #ruby
Yayo has joined #ruby
<LennyLinux>
Does eval.in work for you?
bordicon has quit [Ping timeout: 252 seconds]
sweeper has joined #ruby
<sweeper>
anyone here ever used Ruby-GNOME2?
Lo^80 has joined #ruby
jbueza has joined #ruby
moos3 has joined #ruby
zeade has joined #ruby
<Hanmac>
sweep my friends used that .. but i currently use wxwidgets build against gtk3 with my own wx-ruby extension
<sweeper>
need to do a bit of work with gstreamer, don't particularly care if I use ruby or python, but rest of team would prefer ruby. it needs to be fairly straightforward tho
joofsh has joined #ruby
mityaz has joined #ruby
maxmanders has joined #ruby
interactionjaxsn has quit [Remote host closed the connection]
Lo^04 has quit [Read error: Connection reset by peer]
Loaft has joined #ruby
Lo^64 has joined #ruby
<gestahlt>
Mahoney, thanks that helped partially. Now im a bit confused over the part to create new hashes.. means how can i append hashes?
<gestahlt>
I only manage to replace them
brianherman has joined #ruby
afex has quit [Ping timeout: 240 seconds]
maxmanders has quit [Quit: Computer has gone to sleep.]
Crayanne has joined #ruby
Lo^64 has quit [Read error: Connection reset by peer]
<Crayanne>
Excuse me, but is this where I can ask a simple beginner's question?
xardas has joined #ruby
Lo^20 has joined #ruby
<gestahlt>
I ask them all the time...
Yayo has quit [Ping timeout: 245 seconds]
Yayo has joined #ruby
<mahoney>
gestahlt: Append hashes? Like to an array?
Yayo has quit [Read error: Connection reset by peer]
<gestahlt>
yeah.. like .push
atno has quit [Remote host closed the connection]
<gestahlt>
append hash to hash :)
<mahoney>
You can add to a hash with hash[key] = value
<gestahlt>
Oh? I have the impression it gets overwritten
<mahoney>
The value in that key gets overwritten, but not the whole hash.
Yayo has joined #ruby
<Hanmac>
gestahlt: you can use hash.store(key,value) too
<Crayanne>
I am very new to Ruby and programming in general.
stevechiagozie has quit [Quit: Computer has gone to sleep.]
Loaft has quit [Ping timeout: 252 seconds]
bigoldrock has quit [Remote host closed the connection]
<Hanmac>
Crayanne: you are allowed to ask :P
Yayo is now known as Loaft
<gestahlt>
Confuzing..
<Crayanne>
elsif msg.text == "Hello"
<Crayanne>
reply(msg, "Good day")
stevechiagozie has joined #ruby
<Crayanne>
So if I type in "Hello," it responds "Good day."
jaygen has joined #ruby
robscomputer has joined #ruby
<Crayanne>
What if I want it to pick randomly from one of several responses? Like "Good day" or "Hello to you too."
<gestahlt>
Okay.. i acces to my key with hash[:key] and i get a return value.. ok when i add a new hash to the [:key] its hash[:key] => {}
<gestahlt>
arfff
Lo^20 has quit [Ping timeout: 272 seconds]
Nisstyre-laptop has joined #ruby
josefrichter has quit [Ping timeout: 240 seconds]
zigomir has quit [Quit: zigomir]
<gestahlt>
anyway. gtg
<gestahlt>
cya
gestahlt has quit [Quit: ChatZilla 0.9.89 [Firefox 17.0.1/20121129151842]]
Loaft has quit [Ping timeout: 252 seconds]
SCommette_ has joined #ruby
SCommette has quit [Ping timeout: 252 seconds]
SCommette_ is now known as SCommette
<mahoney>
Crayanne: If you have an array of responses like ["Good day", "Hello to you too", "Howdy!"], then you can use Array#sample to get a random element.
mercwithamouth has quit [Ping timeout: 272 seconds]
Nisstyre-laptop has quit [Ping timeout: 272 seconds]
jimeh has quit [Quit: Computer has gone to sleep.]
daniel_hinojosa has quit [Quit: Leaving.]
Yayo has quit [Ping timeout: 252 seconds]
Yayo has joined #ruby
Ontolog has quit [Read error: Connection reset by peer]
Ontolog has joined #ruby
jfelchner1 has joined #ruby
Lo^56 has joined #ruby
cgore has joined #ruby
Lo^56 has quit [Read error: Connection reset by peer]
Lo^75 has joined #ruby
<logix812>
I have to be something wrong here, I am just trying to send a string through a socket, but I get nothing on the other end: http://dpaste.com/1036789/
<logix812>
The server is listening, I can open a telnet session and send the same string and I get the expected response
sambio has quit [Ping timeout: 264 seconds]
Lo^41 has joined #ruby
havenwood has joined #ruby
breakingthings has joined #ruby
Lo^41 has quit [Read error: Connection reset by peer]
duosrx has quit [Remote host closed the connection]
JohnBat26 has joined #ruby
mellowMike has quit [Quit: leaving]
Lo^75 has quit [Ping timeout: 272 seconds]
SCommette has quit [Quit: SCommette]
Loaft has quit [Read error: Connection reset by peer]
Loaft has joined #ruby
atno has quit [Remote host closed the connection]
Yayo has joined #ruby
reset has joined #ruby
daniel_hinojosa has joined #ruby
r0bby has joined #ruby
Lo^69 has quit [Ping timeout: 256 seconds]
Lo^23 has joined #ruby
kirun has joined #ruby
_nitti has joined #ruby
<failshel_>
anyone knows of a ruby-based website monitoring tool? something in-house
cableray has joined #ruby
Lo^01 has joined #ruby
SCommette has joined #ruby
ToApolytoXaos has joined #ruby
tenmilestereo has joined #ruby
<bean>
logix812: that code works for me w/ netcat listening
angusiguess has quit [Ping timeout: 246 seconds]
Akuma has quit [Ping timeout: 264 seconds]
<logix812>
bean: if data is first sent back over the socket do you have to do anything special before you can send? In my case, on connect a string is sent back immediately
robbyoconnor has quit [Ping timeout: 264 seconds]
Goles has joined #ruby
<bean>
[1] pry(main)> require 'socket'
<bean>
[2] pry(main)> s = TCPSocket.new "localhost", 23
<bean>
=> true
<bean>
[3] pry(main)> s.write "Hello, World!"
<bean>
=> #<TCPSocket:fd 5>
<bean>
=> 13
<bean>
sry for paste
atno has joined #ruby
Loaft has quit [Ping timeout: 246 seconds]
Yayo has quit [Ping timeout: 240 seconds]
Coolhand has joined #ruby
<bean>
and then the other side sees "Hello, World!%"
dustint has quit [Remote host closed the connection]
<logix812>
gah! I see what did…
Lo^23 has quit [Ping timeout: 246 seconds]
Ontolog has quit [Read error: Connection reset by peer]
romanization81 has quit [Ping timeout: 245 seconds]
Ontolog has joined #ruby
reset has quit [Quit: Leaving...]
chussenot has quit [Quit: chussenot]
ryanf has joined #ruby
dustint has joined #ruby
shadoi is now known as blakeb
Lo^01 has quit [Ping timeout: 256 seconds]
tgunr has joined #ruby
sebastianb has quit [Ping timeout: 246 seconds]
tgunr has quit [Client Quit]
Zai00 has quit [Quit: Zai00]
tgunr has joined #ruby
Loaft has joined #ruby
mark_locklear has quit [Remote host closed the connection]
Uranio has quit [Quit: while you reading this, a kitty dies]
rdark has quit [Quit: leaving]
whitedawg has quit [Quit: Leaving.]
sebastianb has joined #ruby
timonv has joined #ruby
dhruvasagar has quit [Ping timeout: 252 seconds]
Yayo has joined #ruby
failshel_ is now known as failshell
divout has quit [Read error: Connection reset by peer]
sebastianb has quit [Remote host closed the connection]
sebastianb has joined #ruby
maxmanders has joined #ruby
sepp2k has joined #ruby
Loaft has quit [Ping timeout: 246 seconds]
tonini has joined #ruby
rickmasta has quit [Quit: Be back later]
Yayo has quit [Ping timeout: 240 seconds]
m8 has joined #ruby
Crayanne has quit []
Akuma has joined #ruby
Loaft has joined #ruby
atno has quit [Remote host closed the connection]
pavilionXP has quit [Ping timeout: 264 seconds]
Hanmac has quit [Ping timeout: 264 seconds]
robscomputer has quit [Read error: Connection reset by peer]
robscomputer has joined #ruby
tjbiddle has joined #ruby
nothingism28 has joined #ruby
Morkel has quit [Quit: Morkel]
Yayo has joined #ruby
Morkel has joined #ruby
cantonic has joined #ruby
robscomputer_ has joined #ruby
atno has joined #ruby
robscomputer has quit [Read error: Connection reset by peer]
dhruvasagar has joined #ruby
Loaft has quit [Ping timeout: 256 seconds]
Shadow_S has joined #ruby
Shadow_S has quit [Remote host closed the connection]
Elhu has joined #ruby
anirudh24seven has quit [Quit: ChatZilla 0.9.89 [Firefox 19.0.2/20130307122853]]
Yayo has quit [Ping timeout: 240 seconds]
Loaft has joined #ruby
rismoney has joined #ruby
_carloslopes has quit [Remote host closed the connection]
carloslopes has joined #ruby
pygmael has joined #ruby
danslo has quit [Quit: danslo]
jcheng has quit [Quit: Computer has gone to sleep.]
Loaft has quit [Ping timeout: 252 seconds]
reset has joined #ruby
gyre007 has quit [Ping timeout: 245 seconds]
amth has joined #ruby
freerobby has quit [Quit: Leaving.]
etcetera has quit []
heliumsocket has quit [Quit: heliumsocket]
andrewh_ is now known as andrewh
w400z has joined #ruby
rickmasta has joined #ruby
mattbl has quit [Quit: This computer has gone to sleep]
etcetera has joined #ruby
mattbl has joined #ruby
mmitchel_ has joined #ruby
averiso has quit [Quit: Computer has gone to sleep.]
tjbiddle has quit [Ping timeout: 272 seconds]
pixie79 has quit [Remote host closed the connection]
<havenwood>
GreatSUN: This just finds the path within the hash of each key with a non-hash value. But could be modified easily to match only a particular key name.
lunks has joined #ruby
emergion has joined #ruby
Skofo has joined #ruby
smigg has quit [Remote host closed the connection]
<havenwood>
GreatSUN: Just updated it to make it more readable.
tantalum has joined #ruby
renanoronfle has quit [Quit: This computer has gone to sleep]
<apeiros_>
good. ruby tells you that "should" and "is" differ.
<apeiros_>
or you got the wrong code.
epta has quit [Ping timeout: 255 seconds]
<mouse-_>
surely you're using it the wrong way :)
<GreatSUN>
apeiros_: I know
Tricon has joined #ruby
maxmanders has quit [Quit: Computer has gone to sleep.]
frozenfoxx has joined #ruby
<GreatSUN>
mouse-_: I see something is wrong, but can't see why
thecreators has quit [Ping timeout: 240 seconds]
<Paradox>
havenwood, cool, i might ask you later
<apeiros_>
GreatSUN: look, if you want better help, provide better information
burgestrand has joined #ruby
mahmoudimus|away has quit [Quit: Computer has gone to sleep.]
<apeiros_>
GreatSUN: you know, like actual code, actual input
burgestrand has quit [Client Quit]
<apeiros_>
sensibly it'd be a reproducable piece of code.
<frozenfoxx>
Don't suppose anyone could tell me real quick how to command RVM to manually re-run the LD_LIBRARY_PATH again? I'm trying to clone a .rvm installation to an identical system but *not* re-run the rvm install again
<frozenfoxx>
Everything seems to work after including the .bash_profile lines myself, but it claims it can't find a library file that's there and i suspect the LD_CONFIG_PATH variable isn't being updated.
geggam_wk has quit [Remote host closed the connection]
<peterud>
Hanmac: ok thanks, so i guess it's there because of an implementation detail - conceptually TrueClass and FalseClass must have their own ! methods
<Boohbah>
ty Hanmac
[Neurotic] has joined #ruby
crimezon120xx has joined #ruby
stevechiagozie has quit [Quit: Computer has gone to sleep.]
timonv has joined #ruby
alexim has quit [Quit: bye]
lewix has quit [Remote host closed the connection]