apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
<apeiros_>
for your show, have a look at `p @data`, `puts @data` and `puts @data.inspect`
Targen has quit [Ping timeout: 245 seconds]
<apeiros_>
(p @data is a short way to express puts @data.inspect)
luckyruby has quit [Remote host closed the connection]
mdw_ has quit [Remote host closed the connection]
mpereira_ has quit [Ping timeout: 252 seconds]
Boohbah has quit [Remote host closed the connection]
Boohbah has joined #ruby
kuranai is now known as kuranai|off
<offby1>
apeiros_: ooh, I didn't know that; I've been typing puts @data.inspect rather a lot :)
<apeiros_>
offby1: require 'pp'; pp data, and require 'yaml'; y data - those two might be of interest too
tommylommykins has quit [Ping timeout: 244 seconds]
nlc has joined #ruby
davidpk has quit [Ping timeout: 256 seconds]
<offby1>
I do the former all the time. The latter might be interesting.
<offby1>
I wonder if yaml knows how to collapse shared stuff the way pp does
* offby1
is too lazy to, you know, actually find out :)
davidpk has joined #ruby
<offby1>
hm, I don't see "y" at all.
ben225 has joined #ruby
beneggett has quit [Ping timeout: 245 seconds]
ben225 is now known as beneggett
sohocoke has joined #ruby
wilmoore has quit [Remote host closed the connection]
kaspernj__ has quit [Ping timeout: 246 seconds]
tommylommykins has joined #ruby
albemuth has joined #ruby
sparrovv has quit [Ping timeout: 250 seconds]
albemuth has quit [Client Quit]
pika_pika has quit [Ping timeout: 246 seconds]
zeromodulus has quit [Remote host closed the connection]
ABK has quit [Read error: Connection reset by peer]
ABK has joined #ruby
savage- has quit [Remote host closed the connection]
chson has joined #ruby
cdepue has quit [Remote host closed the connection]
yankov has quit [Quit: yankov]
otters has joined #ruby
weasels has quit [Read error: Connection reset by peer]
stephenjudkins has joined #ruby
maletor has quit [Quit: Computer has gone to sleep.]
kenperkins has quit [Quit: Computer has gone to sleep.]
yosinof has quit [Quit: Leaving]
chson has quit [Remote host closed the connection]
cdepue has quit [Remote host closed the connection]
frogstarr78 has quit [Quit: Leaving]
yankov has joined #ruby
ABK has quit [Read error: Connection reset by peer]
ABK has joined #ruby
fixl has joined #ruby
rh1n0 has quit [Ping timeout: 256 seconds]
td123 has joined #ruby
stephenjudkins has quit [Quit: stephenjudkins]
jhunter has quit [Ping timeout: 252 seconds]
pdtpatrick has quit [Quit: pdtpatrick]
jhunter has joined #ruby
cordoval has joined #ruby
CannedCorn has joined #ruby
cordoval has left #ruby [#ruby]
mengu has quit [Remote host closed the connection]
mahmoudimus has joined #ruby
ABK has quit [Read error: Connection reset by peer]
ABK has joined #ruby
ben_m has quit [Quit: Leaving]
kaspernj_ has joined #ruby
cdepue has joined #ruby
mahmoudimus has quit [Client Quit]
rrichards has quit [Quit: Leaving...]
kaspernj__ has quit [Ping timeout: 245 seconds]
Ontolog has joined #ruby
beneggett has quit [Read error: Connection timed out]
rh1n0 has joined #ruby
rh1n0 has quit [Client Quit]
rh1n0 has joined #ruby
ABK has quit [Read error: Connection reset by peer]
adamkittelson has quit [Remote host closed the connection]
beneggett has joined #ruby
CannedCorn has quit [Read error: Operation timed out]
rrichards has joined #ruby
Hanmac1 has joined #ruby
Hanmac has quit [Ping timeout: 252 seconds]
codefarmer has quit [Quit: codefarmer]
ciopte7 has joined #ruby
mahmoudimus has joined #ruby
bluenemo has quit [Remote host closed the connection]
looopy has quit [Remote host closed the connection]
rh1n0 has quit [Ping timeout: 244 seconds]
mahmoudimus has quit [Client Quit]
araujo has joined #ruby
araujo has quit [Changing host]
araujo has joined #ruby
techhelp has joined #ruby
luckyruby has quit [Remote host closed the connection]
Taos has joined #ruby
<Taos>
Sup all
<offby1>
pry!
<Taos>
Dropping into ruby from python, anything tahts really gonna catch me out or send me insane or impress me?
yankov has quit [Quit: yankov]
Cicloid has quit [Remote host closed the connection]
RegEchse has quit [Quit: <3 WeeChat (v0.3.8-dev)]
nari has joined #ruby
<offby1>
heh
<offby1>
how about this: blocks don't create their own scope
<offby1>
x = 3; something { |x| x = 10 } ; puts x
<offby1>
will print 10
<offby1>
freaked me out, I tell ya.
rrichards has quit [Quit: Leaving...]
niklasb has quit [Ping timeout: 244 seconds]
<offby1>
Also: it's not as fussy about indentation as python (what language is?) but it's still persnickety about where you put newlines: newlines terminate expressions, except when they don't.
ABK has joined #ruby
CheeToS has joined #ruby
`damien has quit [Quit: `damien]
<banisterfiend>
offby1: does Pry rock out your D. ?
<offby1>
it do and thanks
<offby1>
Taos: : actually I just tried it, and it printed 3. Now I'm confused.
<stanigator>
how do you tell whether rubygems is installed on a system?
Targen has joined #ruby
Alantas has joined #ruby
looopy has joined #ruby
brianpWins has joined #ruby
perryh is now known as perryh_away
codelurker has joined #ruby
ABK has quit [Read error: Connection reset by peer]
<offby1>
maybe type "type gem" at the shell
ABK has joined #ruby
<offby1>
if you see ``bash: type: gem: not found'' that suggests it isn't :)
<Taos>
So wtf is a block?
krusty_ar has quit [Read error: Connection reset by peer]
<Alantas>
Taos: It's kinda like a lambda function, or an inline, anonymous callback.
<Alantas>
You know how you can pass arguments to a method call? You can pass code too; that's a block.
krusty_ar has joined #ruby
deobald__ has joined #ruby
<Taos>
Not gotcha on this one
<Taos>
I fail to understand (for iteration) one does not us ethe std syntax of for a in that:
<Taos>
why some choose def add_stuff(arg1, arg2) puts "Adding: %i and %i" % [arg1, arg2] arg1 + arg2
<Taos>
endnumbers.each do |x|
ABK has quit [Read error: Connection reset by peer]
<Taos>
^
<Alantas>
"for x in y" == "y.each do |x|"
krusty_ar has quit [Remote host closed the connection]
<Taos>
Right
<Alantas>
(Approximately; there's different scoping rules or something, but otherwise for-x-in-y calls out to each()."
<Alantas>
)
<Taos>
so why is there not just "one" way to do iteration? :L
<Alantas>
I usually use the each() syntax since it's more consistent with the many other iterator/block-receiving methods like map(), sort_by() and so on.
<Taos>
so you could say bigger_nums = numbers.map {|x| x * x * x}
<offby1>
yep
<Taos>
Thats kinda kinky
<offby1>
perfectly straightforward for functional programmers
<Alantas>
On a side note: "each{ |x| puts x}" and "each do |x| puts x end" are equivalent; just alternative syntax. I usually use {this} for one-liners and "do ... end" for multi-line blocks.
<offby1>
yeah, I think that's the convention
<Taos>
Riight
<kinesis>
1
<kinesis>
???
<Alantas>
Oh. *Takes a look at kinesis's question.*
<kinesis>
line 22 ,i dont want instance, i want to load a config into variables
<kinesis>
for use throughout the whole infrastructure
<Alantas>
I think it's something along the lines of "instance variable set" or such. *Looks*
<Taos>
eww requires polutes namespaces :(
<kinesis>
huh?\
<kinesis>
i need an answer to this
eka has quit [Quit: Leaving]
cordoval has joined #ruby
<kinesis>
is there a better way to load a yaml config
artm has joined #ruby
<cordoval>
hi guys
<cordoval>
i am trying to understand this line @from = options[:from]
<cordoval>
the [:from] in particular?
<Alantas>
kinesis: You're wanting it to set @instance @variables @by @name? That's generally a bad idea; you should have them as keys in a Hash or something, for setting them by arbitrary, externally-gotten names like that.
<kinesis>
No
<kinesis>
I want them usable throughout the entire ruby classes
<Alantas>
cordoval: It's just a hash key. In this case, it's a Symbol rather than a String.
<kinesis>
like a real config file should be loaded
<kinesis>
I removed the @
<kinesis>
i tried to use variable_set, but there is no such thing, i removed class_variable_set, made it variable_set
<cordoval>
so this would be in a language like php like ---> $option[$this->from] right?
luckyruby has joined #ruby
<Alantas>
Maybe add them to a class-constant Hash. Other code can then access it, while still preserving encapsulation like a Real program should.
<cordoval>
yea yeah i know Alantas, again i have to slave porting this code
<Alantas>
cordoval: No. A :symbol is sorta like a "string", except you can't change it.
<cordoval>
Alantas you rock
<Alantas>
Instance variables (like PHP's $this->foo) are done like @foo
artm has quit [Client Quit]
yosinof has joined #ruby
<kinesis>
so forget using yaml?
<kinesis>
to load config values?
googya has joined #ruby
<Alantas>
And that's just for within the class. You can't use @foo to get an instance var from outside the class; you'll need a "getter" method for that (like "attr_reader :foo" or "attr_accessor :foo" in the class definition).
<kinesis>
is there a better way to do that?
<kinesis>
ok reading
ABK has joined #ruby
<Alantas>
kinesis: No, forget setting global vars' names by external data.
<kinesis>
so do the class_variable_set("@#{val}", key)
<kinesis>
but do attr_accessor
<Alantas>
Set their values by external data, by all means, but not the names themselves. You should control the names. If you have arbitrary names you need to work with, use them as keys in a controlled hash.
<Alantas>
kinesis != cordoval
davidpk has joined #ruby
luckyruby has quit [Remote host closed the connection]
<kinesis>
so ?
<kinesis>
i want to carry the settings within the class
mahmoudimus has quit [Quit: Computer has gone to sleep.]
cbuxton has quit [Ping timeout: 265 seconds]
savage- has joined #ruby
deryl has joined #ruby
deryl has quit [Client Quit]
ABK has quit [Ping timeout: 246 seconds]
nari has quit [Ping timeout: 240 seconds]
ciopte7 has quit [Quit: ciopte7]
<krz>
when i do Time.now.utc i get 1337395359. but in JS, when I do: d = new Date(1337395359); i get: Date {Fri Jan 16 1970 03:29:55 GMT-0800 (PST)}
<krz>
what am i doing wrong?
<krz>
shouldn't it return the current date
<krz>
btw, thats Time.now.utc.to_i
<Alantas>
Maybe JS denominates time in sub-second units? Seems like a strange thing to do, though, when it could just accept a float number of seconds or something. <shrug>
deryl has joined #ruby
sepp2k has quit [Remote host closed the connection]
mahmoudimus has joined #ruby
xhh has quit [Remote host closed the connection]
xhh has joined #ruby
bperry has joined #ruby
<bperry>
I have a question about GetOpenFile() in ruby 1.9.3
<bperry>
does anyone available have much experience with this function?
<bperry>
basically, I get an IOError when I am calling
<bperry>
and I don't know why...
<Alantas>
krz: Yeah; Time.utc(1970,1,1,0,0,0)+1337395.690 » Fri Jan 16 11:29:55 UTC 1970
<bperry>
this code was written in 2006
<bperry>
so it was written with 1.8.7 in mind
<Alantas>
krz: So JS's Date seems to denominate in milliseconds rather than full seconds.
<krz>
needs to be Date(*1000)
cdepue_ has joined #ruby
<bperry>
I have gotten it to compile now and some of it works
<bperry>
but thsi IOError is killing me
<bperry>
it is a ruby gem written in C
Urth|Away is now known as Urthwhyte
deryl_ has joined #ruby
<Alantas>
"GetOpenFile()"? Never heard of it. Doesn't look like it uses typical Ruby naming or organization conventions.
<bperry>
it is used in the ruby stdlib]
<bperry>
but it may very well be deprecated by now
<bperry>
I have no idea
<bperry>
would you like to see code maybe?
deryl_ has quit [Client Quit]
<Alantas>
Oh, it's used internally, not from Ruby itself. That wasn't clear.
liluo has quit [Remote host closed the connection]
beneggett has quit [Read error: Connection timed out]
igotnolegs has joined #ruby
wmoxam has joined #ruby
chico_chicote has quit [Remote host closed the connection]
beneggett has joined #ruby
bigkm has joined #ruby
pika_pika has joined #ruby
kaspernj_ has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
rippa has joined #ruby
mahmoudimus has joined #ruby
mahmoudimus has quit [Client Quit]
nari has quit [Ping timeout: 245 seconds]
rboyd has joined #ruby
cbuxton has quit [Quit: Leaving.]
bigkm has quit [Ping timeout: 256 seconds]
wallerdev has quit [Quit: wallerdev]
bigkm has joined #ruby
moshee has quit [Ping timeout: 250 seconds]
moshee has joined #ruby
moshee has quit [Changing host]
moshee has joined #ruby
wmoxam has quit [Ping timeout: 256 seconds]
pika_pika_ has joined #ruby
zeromodulus has joined #ruby
zeromodulus has quit [Read error: Connection reset by peer]
zeromodu_ has joined #ruby
pika_pika has quit [Ping timeout: 246 seconds]
berserkr has quit [Quit: Leaving.]
zeromodu_ has quit [Remote host closed the connection]
stanigator has quit [Quit: Page closed]
zeromodu_ has joined #ruby
FCWBilly has joined #ruby
leojweda has joined #ruby
<leojweda>
this is my first time using ruby as a scripting language (as opposed to with rails). why do i keep getting an error on line 12 saying unexpected end? https://gist.github.com/a5c5621d691be154296a
zeromodu_ is now known as zeromodulus_
fivetwentysix has joined #ruby
ipoval has quit [Quit: ipoval]
rh1n0 has quit [Quit: Leaving...]
Urthwhyte is now known as Urth|Away
<seanstickle>
Two items: don't use so much indent
<seanstickle>
2 spaces
fragrant has joined #ruby
<seanstickle>
And second, Ruby doesn't have self-increment
fragrant has left #ruby [#ruby]
<seanstickle>
other++ is not valid Ruby
zeromodulus_ is now known as zeromodulus
CheeToS has quit [Ping timeout: 252 seconds]
<leojweda>
seanstickle: thanks :)
wilmoore has joined #ruby
xiaotian has joined #ruby
iamjarvo has joined #ruby
zeromodulus has quit [Ping timeout: 248 seconds]
emmanuelux has quit [Remote host closed the connection]
adeponte has joined #ruby
inteq has joined #ruby
zeromodulus has joined #ruby
jcromartie has quit [Quit: jcromartie]
leojweda has quit [Quit: So Long, and Thanks for All the Fish]
ananthakumaran has joined #ruby
yankov has joined #ruby
beneggett has quit [Quit: Computer has gone to sleep.]
beneggett has joined #ruby
bigkm has quit [Ping timeout: 244 seconds]
kaspernj_ has quit [Ping timeout: 246 seconds]
kil0byte has quit [Remote host closed the connection]
beneggett has quit [Client Quit]
adeponte has quit [Remote host closed the connection]
ciopte7_ has joined #ruby
bigkm has joined #ruby
LBRapid has joined #ruby
ryanf has joined #ruby
kil0byte has joined #ruby
kevinbond has quit [Quit: kevinbond]
moshee has quit [Ping timeout: 248 seconds]
moshee has joined #ruby
CannedCorn has joined #ruby
rippa has quit [Ping timeout: 252 seconds]
kaspernj_ has joined #ruby
macmartine has quit [Quit: macmartine]
perryh_away is now known as perryh
neersighted is now known as neersighted|AFK
banisterfiend has quit [Read error: Connection reset by peer]
Jackneill has quit [Read error: Connection reset by peer]
Eldariof-ru has joined #ruby
mahmoudimus has joined #ruby
nari__ has joined #ruby
sei has joined #ruby
krz has quit [Ping timeout: 248 seconds]
indeterminate has quit [Ping timeout: 245 seconds]
krz has joined #ruby
nari_ has quit [Ping timeout: 265 seconds]
gosshedd has joined #ruby
amalvagomes has quit [Quit: amalvagomes]
nari__ has quit [Ping timeout: 244 seconds]
ABK has quit [Read error: Connection reset by peer]
ABK has joined #ruby
Eldariof59-ru has joined #ruby
Eldariof-ru has quit [Ping timeout: 244 seconds]
CheeToS has quit [Ping timeout: 250 seconds]
ciopte7 has quit [Quit: ciopte7]
sam113101 has quit [Remote host closed the connection]
ukwiz has joined #ruby
sam113101 has joined #ruby
nari__ has joined #ruby
cj3kim has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
rdegraci has quit [Quit: rdegraci]
schovi has joined #ruby
nari__ has quit [Ping timeout: 276 seconds]
yoklov has quit [Quit: computer sleeping]
banisterfiend has quit [Read error: Connection reset by peer]
sandGorgon has quit [Ping timeout: 240 seconds]
mikepack has quit [Remote host closed the connection]
eka has joined #ruby
ABK has quit [Read error: Connection reset by peer]
minijupe has quit [Quit: minijupe]
ABK has joined #ruby
banisterfiend has joined #ruby
mikeg has quit [Ping timeout: 248 seconds]
mdw has quit [Remote host closed the connection]
xaq has quit [Read error: Connection reset by peer]
ph^ has joined #ruby
Eldariof27-ru has joined #ruby
bambanx has quit [Read error: Connection reset by peer]
Ontolog has quit [Read error: Connection reset by peer]
Eldariof59-ru has quit [Ping timeout: 245 seconds]
petercs has joined #ruby
Ontolog has joined #ruby
googya has left #ruby [#ruby]
blacktulip has joined #ruby
kil0byte has joined #ruby
francisfish has joined #ruby
visof has joined #ruby
visof has quit [Changing host]
visof has joined #ruby
becom33 has joined #ruby
<becom33>
hi I'm about code a very simple framework . how is my folder structure should be ?
wilmoore has quit [Remote host closed the connection]
* becom33
anyone ?
wilmoore has joined #ruby
<becom33>
anyone ?
bier_ has quit [Read error: Operation timed out]
tomb_ has quit [Quit: Computer has gone to sleep.]
Corey has quit [Ping timeout: 612 seconds]
kaspernj has quit [Ping timeout: 246 seconds]
Solnse has joined #ruby
nlc has quit [Quit: Leaving]
blacktulip has quit [Remote host closed the connection]
Morkel has quit [Quit: Morkel]
beneggett has quit [Ping timeout: 252 seconds]
ananthakumaran1 has joined #ruby
ABK has quit [Read error: Connection reset by peer]
ABK has joined #ruby
ananthakumaran has quit [Ping timeout: 244 seconds]
danguita has joined #ruby
nikhgupta has joined #ruby
nikhgupta has quit [Client Quit]
<xhh>
becom33: check the existing framework/lib sources
beneggett has joined #ruby
<becom33>
xhh, its hard to fine a simple scripting framework . most of them are web frameworks . the left scripting once are hard to read
mdw has joined #ruby
<xhh>
becom33: what kind of framework are you going to build?
bier_ has joined #ruby
<becom33>
xhh, a simpel scripting framework . where you can add plugins and stuff
tvw has joined #ruby
tvw has quit [Remote host closed the connection]
tvw has joined #ruby
kaspernj has joined #ruby
ph^ has quit [Remote host closed the connection]
schovi has quit [Remote host closed the connection]
ananthakumaran has joined #ruby
ananthakumaran1 has quit [Ping timeout: 246 seconds]
<xhh>
becom33: i see, no experiences on it though :)
<shevy>
becom33 in general use name/lib/name
<shevy>
the first name you can drop
<shevy>
but for instance, I have a project that I called "web_foundation"
<shevy>
it resides in the directory $RUBY_SRC which is a variable I use to denote my base ruby things (all the .rb files I write)
<shevy>
in that $RUBY_SRC directory, I have a directory called web_foundation/
<shevy>
in that directory, I have a lib/ folder, and in that lib/ folder I have web_foundation/ directory and web_foundation.rb file, which does call to the require files
<shevy>
then when I want to use this project, I just do:
<shevy>
require 'web_foundation'
<becom33>
shevy well you saw my yesterday coding right ? i know its horrible . when I starts to write it I didnt have much of coding knowledge. but If I have a correct stucture I might be able to do a clean code now
<shevy>
nah, your code can still be ugly
<shevy>
but at least you can do
<shevy>
require 'name_of_project'
<shevy>
some projects also have a bin/ directory
<shevy>
and test/ directory
ryanf has quit [Quit: leaving]
<shevy>
but lib/ is the most important one really
FCWBilly has quit [Quit: Leaving]
<shevy>
becom33 it really is easier if you focus on a very tiny project
<shevy>
with i.e. only one or two .rb files
senny has joined #ruby
<shevy>
making a huge ass framework out of nowhere is harder :)
<shevy>
also, I found that large projects require a lot more documentation than I would have expected, than small projects
<shevy>
it seems an exponential, rather than a linear increase :(
kil0byte has quit [Remote host closed the connection]
RurouniJones has joined #ruby
<becom33>
shevy, ok . in my script I have file like . core.rb(core variables for everyfile), prompt.rb(readline),function.rb(commands methods)
<becom33>
so those files should be inside lib folder right ?
francisfish has quit [Ping timeout: 244 seconds]
igotnolegs has quit [Quit: Computer has gone to sleep.]
krz has quit [Quit: krz]
<shevy>
becom33 yes
<shevy>
well
<shevy>
lib/web_foundation/
<shevy>
lib/name_of_your_project
<becom33>
so lib/my_project_name ?
<shevy>
let me look at pry gem
<shevy>
pry-0.9.9.4/lib/pry/
<shevy>
yeah becom33
<shevy>
I just verified
tomzx has quit [Ping timeout: 244 seconds]
<shevy>
pry uses lib/pry/ directory
<shevy>
and also has the
<shevy>
lib/pry/pry.rb file
<shevy>
this file you need to make for your project too
<shevy>
lib/my_project_name/
<shevy>
and
<shevy>
lib/my_project_name/my_project_name.rb
<becom33>
shevy, so where is the first my executable file should be ?
<shevy>
an executable?
<shevy>
you already have an executable?
<shevy>
it goes into bin/
ABK has quit [Ping timeout: 248 seconds]
<shevy>
but I am not sure you have an executable already
<shevy>
"Additionally, if you try running the command newgem --simple [projectname] that'll quickly generate a scaffold for you with just the bare essentials for a Ruby project"
<shevy>
try this too becom33
<shevy>
probably have to do "gem install newgem" first
<shevy>
"appname" is the same as "project name" usually. at least I follow this convention all the time
<shevy>
but if you like confusion, you could name your project "foo", and write a "bar.rb" file instead, so that people need to do require 'bar' rather than require 'foo' ... ;)
<shevy>
I will stick to "foo" and "foo.rb" however.
<RurouniJones>
SpaxeX Falcon9 Launch live webcast at spacex.com/webcast/ in case any geeks are interested - Launch T-15 minutes
<Alantas>
I don't think a $global is called for there. Perhaps a class constant instead.
bluenemo has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
<shevy>
becom33 it's kinda useless to define a $global in your class
L-----D has joined #ruby
<shevy>
why dont you use @instance_variables becom33 ?
<becom33>
shevy, that $globle will be used in several places
<Alantas>
Probably just: class Core; Prompt = "myframework"; end; while linein = Readline.readline(Prompt+">", true)
ddv has joined #ruby
sparrovv has joined #ruby
<shevy>
becom33 ok, you know your code. but I also tell you, it is rare to really need a global variable
ddv has quit [Changing host]
ddv has joined #ruby
<Alantas>
Or a @@class_var or something.
<becom33>
Alantas, those are two deffent files
<Alantas>
becom33: Yes, but class Constants/@@vars should be inherited.
<becom33>
shevy, wait let me try instance variable
<shevy>
class var are terrible
<shevy>
constants are ok
batmanian has joined #ruby
<shevy>
if you however want to change the prompt
mdw has joined #ruby
<shevy>
and already subclass
<shevy>
why don't you use @prompt instead?
<shevy>
and if it does not change ever, then using a CONSTANT is much better too
banisterfiend has joined #ruby
<becom33>
shevy, it changes so I'll try instent variable wait
mdw has quit [Remote host closed the connection]
<banisterfiend>
becom33: r u making a pry clone
<becom33>
banisterfiend, no no . still learning :P
nari__ has quit [Ping timeout: 250 seconds]
<banisterfiend>
shevy: are you here?
tayy has joined #ruby
<becom33>
shevy, in my exeutable file . my prompt require is require './lib/prompt' . is this a correct way to require a custome class ? it works . but not sure if its right
keanehsiao has joined #ruby
keanehsia has joined #ruby
<Hanmac>
becom33 the correct way is require_relative "lib/prompt"
<becom33>
aghh I see
mdw has joined #ruby
<becom33>
Hanmac, undefined method `require_relative' for main:Object (NoMethodError)
<shevy>
in my new projects though, I tend to put all require files into their own directory , or at least into one file
<shevy>
usually I call it requires.rb or something like that
Ontolog has quit [Read error: Connection reset by peer]
<becom33>
i see
Ontolog has joined #ruby
<shevy>
I think the name requires.rb or something else is better
<becom33>
shevy, btw if i just do require 'lib/prompt' would it work in the lastest versions ?
nicoulaj has joined #ruby
<shevy>
it should work yes
<shevy>
wait
<shevy>
in which file actually
<shevy>
if you start irb, then this should suffice:
<shevy>
require 'prompt'
<shevy>
that is the whole point of doing that, really
Yarou has quit [Ping timeout: 244 seconds]
<shevy>
if you write into lib/prompt.rb however, you need to call the specific .rb files you wanna load
<pridian>
Hi, I was just wondering where Ruby falls in it's capablilites relative to a language like C# or Java? I'm considering learning it and I'd like to get a better idea of what it can or can't do before I do.
<shevy>
becom33 on your system, for some reason, you use both /usr/lib and /usr/local/lib
<shevy>
that would confuse me to no ends
kil0byte has joined #ruby
ABK has quit [Read error: Connection reset by peer]
L-----D has quit [Ping timeout: 252 seconds]
<pridian>
shevy: have you had any experience with the java community? so far I've been digging ROR for that reason alone, but my degree is leading me down the road of multithreaded apps so I might as well bank off of that knowledge.
ABK has joined #ruby
<becom33>
shevy, I dont know about much configarations
<RurouniJones>
pridian: you seem to be conflating ruby the language and RoR the framework
<RurouniJones>
They are quite separate
Choobie has quit [Ping timeout: 246 seconds]
<shevy>
pridian nope, I dont have any experience with java nor the community. java is way too verbose for my taste too, and I use ruby for all my projects since 7 years or some such
<RurouniJones>
RoR is threadsafe, no problem. Ruby the language does not support native threads.
<RurouniJones>
Unless you use Jruby (Ruby that compiles to the JVM)
<shevy>
pridian, I also dont use RoR ;) all my web stuff is in ruby though
<RurouniJones>
Maybe the other implementations also do it but JRuby probably the btest
Eldariof27-ru has quit []
<shevy>
becom33 yeah I have no idea either. I would however always remove those ruby, and then compile from source
<shevy>
by default compile into /usr prefix
<shevy>
my brain just does not accept that ruby is split in any way into /usr/lib and /usr/local/lib
<becom33>
shevy, he he
<shevy>
anyway becom33 "/usr/local/lib/site_ruby" should be your site ruby dir
<pridian>
thanks for your help
<shevy>
if you install your project, it will probably end up there
<pridian>
bye
pridian has left #ruby ["Leaving"]
<shevy>
or rather
<shevy>
site_ruby/1.8/YOUR_PROJECT_NAME
<RurouniJones>
If you are on a linux system then install the ruby that came with the system
<shevy>
there /usr/local/lib/site_ruby/1.8/YOUR_PROJECT_NAME
<RurouniJones>
Then use RVM to install the other various versions
<RurouniJones>
(Heck, with RVM you dont even need your system ruby but it is a nice backup)
<becom33>
shevy, I see
<shevy>
becom33 you could use RVM and ask RurouniJones how to use it :)
<becom33>
sure shevy . but I need to do the coding first :/
<shevy>
hehehe
<shevy>
yeah
<shevy>
go and install your project man
<shevy>
or try on a smaller project
<shevy>
when you did this ONCE on your own
<shevy>
you will understand it all suddenly
zeromodulus has quit [Ping timeout: 244 seconds]
indeterminate has joined #ruby
<becom33>
shevy, do you mind . I'll keep writing my codes and I'll show you what i've done in gits ?
banisterfiend has quit [Read error: Connection reset by peer]
dhaskew_ has joined #ruby
dhaskew has quit [Read error: Connection reset by peer]
dhaskew_ is now known as dhaskew
mdw has quit [Remote host closed the connection]
<shevy>
becom33 you can paste here in #ruby
<shevy>
I have to go shopping now though, sorry
<becom33>
shevy, its alright . you have funn
sei has quit [Ping timeout: 246 seconds]
dhaskew has quit [Read error: Connection reset by peer]
dhaskew has joined #ruby
mdw has joined #ruby
burgestrand1 has joined #ruby
pietr0 has joined #ruby
banisterfiend has joined #ruby
cantonic has joined #ruby
burgestrand has quit [Ping timeout: 250 seconds]
sei has joined #ruby
visof has quit [Ping timeout: 246 seconds]
indeterminate has quit [Ping timeout: 256 seconds]
fivetwentysix has quit [Quit: fivetwentysix]
c0rn has quit []
zeromodulus has joined #ruby
danguita has quit [Ping timeout: 260 seconds]
berkes has joined #ruby
berkes has quit [Max SendQ exceeded]
berkes has joined #ruby
berkes has quit [Max SendQ exceeded]
lkba has quit [Ping timeout: 240 seconds]
berkes has joined #ruby
berkes has quit [Max SendQ exceeded]
berkes has joined #ruby
ctp has joined #ruby
d3c has quit [Ping timeout: 248 seconds]
ermines has joined #ruby
weasels has quit [Read error: Connection reset by peer]
DMKE has joined #ruby
ronniy has joined #ruby
dbgster has joined #ruby
jbw has quit [Ping timeout: 265 seconds]
ctp has quit [Client Quit]
ctp_ has joined #ruby
Foxandxss has joined #ruby
schovi has joined #ruby
xhh has quit [Quit: xhh]
ctp_ has quit [Client Quit]
Ontolog has quit [Remote host closed the connection]
keanehsia has quit [Read error: Connection reset by peer]
keanehsiao has quit [Read error: Connection reset by peer]
rdegraci has joined #ruby
jbw has joined #ruby
A1241 has joined #ruby
azm has joined #ruby
IanV has joined #ruby
adambeynon has quit [Read error: Connection reset by peer]
adambeynon_ has joined #ruby
A1241 has left #ruby [#ruby]
niklasb has joined #ruby
<IanV>
hiya ppl! I have a question regarding parsing a CSV file, Im getting a exception MalforedCSVError, mainly due to the file containing many different encoded chars I believe. im using ruby 1.9.3p-125, standard CSV . I dont care that it raised the excpetion, what I want to be able to do is continue reading the file, but how can that be done in a foreach block?
ctp_ has joined #ruby
berkes has quit [Quit: Ex-Chat]
xhh has joined #ruby
khakimov has joined #ruby
ctp_ has quit [Client Quit]
schovi_ has joined #ruby
nari__ has joined #ruby
yankov has joined #ruby
rdegraci has quit [Quit: rdegraci]
schovi has quit [Ping timeout: 250 seconds]
<shevy>
IanV do you rescue the exception
<IanV>
not yet, as I was thinking if I did, how could I continue? code would be "CSV.foreach......do block; end; rescue" how could I get the CSV foreach to continue?
<IanV>
ie, I dont know where to put a rescue that would allow the loop to continue?
<becom33>
shevy, I thought you went shopping ?
fixl has joined #ruby
<shevy>
becom33 I am back, I have to walk only ~3 minutes
<becom33>
shevy, aghh alright . good thing your back In stuck with a logic issue
<Hanmac>
he lives over the shop
<shevy>
hey, in the middle of vienna you kinda have shops all around you
<becom33>
do you remember I used .send to call methods and pass argivments method ?
vjt has quit [Ping timeout: 272 seconds]
<shevy>
ewwww .send
<becom33>
shevy, thats how I used my commands
<shevy>
I once used .send together with .method_missing
vjt has joined #ruby
<shevy>
in my opinion it just promotes fragile design
<becom33>
so now I was thinking write a each class for a command
<shevy>
IanV, you miss the keyword "begin"
<shevy>
IanV, if you do "1 / 0" you would get an error like ZeroDivisionError: divided by 0
<shevy>
to begin rescue that you can do
<IanV>
well., from my little eg above yes, but I do have it in code
<shevy>
begin; 1 / 0; rescue; puts 'Oh no, pink ponies to Infinity!'; end
zeddy253 has joined #ruby
<shevy>
if you use begin/rescue, the loop does not continue??
<IanV>
my question is, once I've caught it, I want to just igore the erorr and carry on the foreach, but the rescue is outside the foreach
<Hanmac>
you must use begin and rescure inside the loop
<banisterfiend>
shevy: how's your evening
<shevy>
banisterfiend, I just ate cheese which was bad :(
<becom33>
so whateva I have to do when the command is given will be done inside tge class . I have two problems now . one is I dont know how can I identify the commands coz those deffent deffent classes and the second thing . I hate write "help" command so when I ever i write class for a command it should automatically generate a help
xhh has quit [Quit: xhh]
<shevy>
it's 12:27 here though
<IanV>
ok, i'll move it and try that, I didnt think that would work... brb...
<becom33>
shevy,
<shevy>
becom33 cant you just use an array
<shevy>
in that array register all your classes
<shevy>
and whenever you have to display help, that array has stored all your things
<shevy>
and you can use .each on it
<banisterfiend>
shevy: you shouldn't eat anything, you're too fat already
<shevy>
banisterfiend, true but I lost pounds the last weeks
<shevy>
until I go to bed today I may not eat anything
<banisterfiend>
shevy: how much do u weigh now
<shevy>
you'll laugh :(
<banisterfiend>
shevy: tell me
<becom33>
shevy, yes thats what I was thinking use a array , use accessor . but how'd i send commands to each array coz some commands need pass argivements
<IanV>
yeah, didnt think that would work! the foreach is raising the error, not the use of any data within the block! so I need to rescue the foreach, which of course then is outside the block, ie has exited the loop!
<becom33>
shevy, lemme code somthing and let you know . talking is useless . lets see if it works
pridian has joined #ruby
pridian has quit [Quit: Leaving]
<shevy>
becom33 I think you are doing this all very strangely
<becom33>
shevy, why ? well i do have another idea . use methods as command before . just use array to store commands and discription on each method
<becom33>
shevy, if you have better idea please shoot
ABK has quit [Read error: Connection reset by peer]
ABK has joined #ruby
yankov has quit [Quit: yankov]
kil0byte has quit [Remote host closed the connection]
BeLucid has quit [Read error: Operation timed out]
BeLucid has joined #ruby
twinturbo has joined #ruby
<twinturbo>
Hey, what can I use to write a terminal program?
ABK has quit [Read error: Connection reset by peer]
ABK has joined #ruby
zeromodulus has quit [Remote host closed the connection]
<Hanmac>
twinturbo: ruby?
<twinturbo>
well, yes I know that. I should've been more specific. I'm looking for a gem to help make a text based UI (similar to ncurses)
Targen has quit [Ping timeout: 240 seconds]
<Hanmac>
twinturbo, it exist an gem that binds ncurses to ruby
khakimov has quit [Quit: Computer has gone to sleep.]
tchebb has quit [Quit: Leaving.]
jimeh2 has joined #ruby
dbgster has quit [Quit: dbgster]
xhh has quit [Quit: xhh]
tchebb has joined #ruby
nari__ has quit [Ping timeout: 265 seconds]
iocor has joined #ruby
ABK has quit [Ping timeout: 244 seconds]
berserkr has joined #ruby
jimeh2 has quit [Ping timeout: 260 seconds]
mdw has quit [Remote host closed the connection]
sandGorgon has joined #ruby
ABK has joined #ruby
ZachBeta has joined #ruby
<twinturbo>
Hanmac: I believe that's what I want. I want to display some progress bars and live updating values in the terminal. Not 100% if ncurses is what I need
quuxman has joined #ruby
<quuxman>
Anybody here use the sass library for compiling css?
Beoran__ has quit [Ping timeout: 245 seconds]
<Hanmac>
... be caeful there might be a patent of ProgressBars :P
<twinturbo>
so i've learned
visof has quit [Ping timeout: 246 seconds]
tayy has quit [Remote host closed the connection]
mneorr has joined #ruby
looopy has quit [Read error: Connection reset by peer]
looopy has joined #ruby
Headie has joined #ruby
tomb_ has joined #ruby
ABK has quit [Read error: Connection reset by peer]
Headie has quit [Client Quit]
ABK has joined #ruby
ABK has quit [Read error: Connection reset by peer]
ABK has joined #ruby
rookfood has joined #ruby
Headie has joined #ruby
weasels has joined #ruby
Headie is now known as skogis
ermines has quit [Read error: Connection reset by peer]
<madscientist_>
hum, i just looked at all the stuff incoming from irc and devised a way to split it up so that it makes sense frankly
<shevy>
in my pseudo shell, I want to use something like "connect", connect to #ruby by default (or any other default, configurable setting), ask some questions, then disconnect again and drop back to the pseudo-shell
nicoulaj has quit [Remote host closed the connection]
<shevy>
I once wrote an IRC bot too, but that code is so ancient. I am scared just by looking at it alone :(
* apeiros_
thinks most irc clients were created that way - which is why there's a ton of broken irc clients…
altious has quit [Ping timeout: 246 seconds]
<madscientist_>
;o
jimeh2 has joined #ruby
<shevy>
yeah
<shevy>
it's kind of strange IMHO
<shevy>
ruby makes it easy to create something like that with a little bit of work
schaerli has joined #ruby
<shevy>
but high quality, reusable libraries seem to be rare
netogallo has joined #ruby
weasels has joined #ruby
otters has quit [Read error: Connection reset by peer]
<quuxman>
how do I do a dictionary lookup that generates an exception if the key doesn't exist?
<banisterfiend>
quuxman: fetch
ZachBeta has quit [Quit: Computer has gone to sleep.]
<quuxman>
banisterfiend: thanks... is there a way to get the interpreter to print the value of the key along with the "key not found" exception?
<banisterfiend>
quuxman: Maybe
jackiechan0 has quit [Quit: Sto andando via]
<quuxman>
how do I raise an exception with a custom message?
jackiechan0 has joined #ruby
<quuxman>
scratch that, I can look that up
heftig has joined #ruby
Shoobdidoo has joined #ruby
_md has joined #ruby
Shoobdidoo has quit [Client Quit]
<Alantas>
Pass a block to the 'fetch', and it'll yield the failed key, from which you can raise your exception.
Jrz has joined #ruby
fr0gprince_mac has joined #ruby
sandGorgon has quit [Ping timeout: 246 seconds]
L-----D has joined #ruby
jackiechan0 has quit [Client Quit]
jackiechan0 has joined #ruby
<quuxman>
Alantas: that is far too complex for me. I just wrapped it in a begin / rescue clause
<Alantas>
result = table.fetch("word") { |failed_word| raise "Key \"#{failed_word}\" not found }
skogis has quit [Quit: leaving]
Chryson has joined #ruby
_md has quit [Client Quit]
<Alantas>
* not found" }
mpereira has joined #ruby
skogis has joined #ruby
mxweas has quit [Ping timeout: 272 seconds]
<quuxman>
Alantas: ah cool
<quuxman>
ruby is so much more concise than Python
<weasels>
and so much less ugly
<shevy>
often
<quuxman>
looks like there's some correspondance between blocks and perl's $_
jobicoppola has quit [Quit: Computer has gone to sleep.]
skogis has quit [Client Quit]
sandGorgon has joined #ruby
mxweas has joined #ruby
<quuxman>
sort of.. it's more like an optional argument
<quuxman>
can any function accept a block?
<Alantas>
I guess so? But blocks are more general, and can be passed to any method, not just specially-designated ones.
<quuxman>
how does fetch pass |failed_word| ?
<Alantas>
yield
skogis has joined #ruby
<quuxman>
which I assume is basically like Python's yield?
<Alantas>
(From within a method, 'yield whatever' will invoke the block with that argument.)
<Alantas>
I dunno. Ruby's came first. :P
<quuxman>
what if there is no yield?
skogis has quit [Client Quit]
<Alantas>
Then the block isn't executed. Like in the table.fetch example I gave: if the key *was* found, it will simply be returned and the block not run.
skogis has joined #ruby
jackiechan0 has quit [Ping timeout: 248 seconds]
<quuxman>
well in python yield returns a generator
<Mon_Ouie>
Also, a block can be stored in a variable for later use — instead of being called directly.
<quuxman>
and presumably in Ruby, the generator takes the form of an anonymous function that accepts a block, instead of an ojbect like in Python
<quuxman>
is a block just an anonymous function?
<Alantas>
Aye. Useful for event handlers. button.when_clicked { puts "I have been clicked" }
<Alantas>
quuxman: Pretty much.
<quuxman>
sounds like there are subtle differences
<Mon_Ouie>
Ruby has Enumerator, which I believe is like the Python feature you're describing
<Alantas>
There's no "generators", though; it's basically just a special argument.
<quuxman>
enumerators and generators are different things in python
<Alantas>
(There are 'enumerators', though, which some methods might return if not passed a block when they normally would get a block, but that's another matter.)
<Mon_Ouie>
fibo = Enumerator.new { |y| a, b = 0, 1; loop { y << a; a, b = b, a + b } }
<Alantas>
In my experience, they're mostly useful for stacking iterators, like array.each_with_index.map { |item, index| ... }
<Mon_Ouie>
fibo.take 10
heftig_ has joined #ruby
<quuxman>
Anybody here use sass?
<Alantas>
Another handy use is for things like File.open("filename") { |filehandle| ... } -- File.open will open the file, yield it, then close it after the block is run, so you don't have to.
<banisterfiend>
quuxman: Mon_Ouie's example is analogous to a generate in python
<banisterfiend>
generator
googya has joined #ruby
keanehsiao has joined #ruby
<Alantas>
If you call a method like 'each' without passing a block, it typically returns an Enumerator. Otherwise, it just yields to the block as usual, no enumerator/generator needed.
<Alantas>
(It's not automatic; the method has to make a point of doing it. But it's commonly done.)
<quuxman>
huh
becom33 has quit [Ping timeout: 276 seconds]
<quuxman>
does yield return a continuation?
codefarmer has joined #ruby
inteq has quit [Ping timeout: 244 seconds]
becom33 has joined #ruby
<Alantas>
No. It just invokes the block.
heftig has quit [Ping timeout: 265 seconds]
weasels has quit [Read error: Connection reset by peer]
otters has joined #ruby
Eldariof59-ru has joined #ruby
<Alantas>
That fetch() example might be done as: def fetch(key); if key?(key) then return self[key] else yield key end; end
liluo has quit [Remote host closed the connection]
<quuxman>
ah ok. So it's sort of like just having two different return paths
<Alantas>
I dunno if this'll make it clearer, but: def fetch(key, &block); if key?(key) then return self[key]; else block.call(key); end; end
<Mon_Ouie>
yield returns the result of the block (like block.call in the above example)
<Alantas>
Sorta; yielding doesn't trigger a return, it's more like calling a method.
wmoxam has joined #ruby
<Alantas>
Methods like 'each' will yield to the block multiple times (once for each item), for example.
<quuxman>
man that's bizarre
<quuxman>
it's an implicit function argument
<quuxman>
or, just a funny syntax for passing a lambda
<Alantas>
Pretty much, yeah. Like an anonymous callback.
<banisterfiend>
quuxman: exactly, and the cool thing about it, is it's passed outside the parameter list
<banisterfiend>
quuxman: so you can define what look like new control structures i.e: my_if(condition) { }
<Alantas>
The "&block" thing allows the method to (also) receive it as a Proc object that it can store or call out to or do other things with. But normally it's implicit.
<banisterfiend>
quuxman: in fact, even the 'loop' construct in Ruby, is actually just a method that takes a block
<banisterfiend>
quuxman: loop { puts "hi" }
Eldariof-ru has quit [Ping timeout: 265 seconds]
<Alantas>
Yep. That might be implemented with something like: def loop; yield while true; end
<quuxman>
right. It gets around the issue of evaluation order and special forms in scheme
schovi has quit [Read error: Connection reset by peer]
<banisterfiend>
Hanmac: dont start on that yet :P
jackiechan0 has joined #ruby
<Hanmac>
or Dir["*"].map(&File.method(:size)).inject(:+)
<banisterfiend>
quuxman: much nicer than ugly obj-c 'blocks' (which are passed INSIDE the parameter list) i.e: dispatch_async(my_queue, ^{ ..my block content });
<banisterfiend>
in ruby that would look like: dispatch_async(my_queue) { ..my block stuff }
<quuxman>
don't know obj-c.. my background is C, perl, JavaScript, scheme, Haskell, Python...
kenperkins has joined #ruby
<quuxman>
Hanmac: do'n know what '&' does
<Hanmac>
it itsnt obj-c, that what i post is valid ruby
<Alantas>
The & is kinda an advanced thing. Heh.
<banisterfiend>
quuxman: you don't want to know about it yet, Hanmac is silly to bring that up now
<Hanmac>
&obj before an object is similar to obj.to_proc
<Alantas>
[1,2,3,4].map(&:to_s) is shorthand for: [1,2,3,4].map{|i| i.to_s}
<quuxman>
reminds me of Perl's sigils. I'm sure they're entirely different, but man it took me forever to figure out the difference betweenn a list and an array in perl :-P
<Alantas>
Basically, it returns a new array consisting of the original array, with the items replaced by the result of calling to_s on them.
perryh is now known as perryh_away
<quuxman>
Alantas: not too advanced... just shorthand for calling a method
<Alantas>
In the context of a block, yeah.
banisterfiend has quit [Read error: Connection reset by peer]
jcromartie has quit [Quit: jcromartie]
seanstickle has joined #ruby
adambeynon_ has quit [Quit: adambeynon_]
<quuxman>
looks like ^ is some sort of special prefix thing too
<quuxman>
anyway, I'm trying to figure out this exception from sass...
<Alantas>
That's from the Objective-C example, not Ruby.
<quuxman>
error: stderr=TypeError: can't convert Sass::Script::String into String
<Mon_Ouie>
Btw, Ruby has sigils, but they indicate variable scope rather than data type
<quuxman>
if I just pass a regular string in there, it works
<Mon_Ouie>
(@foo for ivar, $foo for globals, …)
<quuxman>
Mon_Ouie: sort of like CoffeeScript?
codebeaker has joined #ruby
<Mon_Ouie>
I don't know CoffeScript, but I'd guess so
sandGorgon has quit [Ping timeout: 246 seconds]
<quuxman>
well, it only has one sigil, '@', which is overloaded to refer to lexical or object scope, depending on the block syntax. Kinda weird
<quuxman>
actually, that's not quite it.
<Alantas>
@foo means the same thing as syntax such as "this->foo" in other languages.
schovi has joined #ruby
<quuxman>
in ruby?
<Alantas>
Yeah, "@foo" in Ruby.
<quuxman>
that's where CoffeeScript got that I presume
<Alantas>
Wikipedia lists Ruby as one of the languages CoffeeScript was influenced by. So, perhaps.
<quuxman>
any clues on that exception?
<Alantas>
What line is it reporting the exception from?
L-----D has quit [Quit: Leaving]
philcrissman has joined #ruby
<quuxman>
don't know, don't have a traceback
<quuxman>
this code is being called from sass, which is called from the sass binary, which is called from a python library called webassets, which is being called by my code
skogis has quit [Quit: leaving]
<quuxman>
I don't even know where to add the --trace argument
<quuxman>
kind of a ridiculous toolchain, but all the python libraries for css compilation kinda sucked
skogis has joined #ruby
<Hanmac>
quuxman: sass has also an commandline tool ... try to call it directly
skogis has quit [Client Quit]
Gavilan has quit [Read error: Connection reset by peer]
dhaskew has joined #ruby
<quuxman>
Hanmac: it has who knows what kind of path problems
netogallo has quit [Read error: Connection reset by peer]
weasels has quit [Read error: Connection reset by peer]
ctp_ has joined #ruby
jeedey has joined #ruby
<Alantas>
The forward slash. A useful but treacherous ally.
ukwiz has quit [Quit: Leaving]
mrwalker has quit [Remote host closed the connection]
yoklov has joined #ruby
ping-pong has quit [Ping timeout: 245 seconds]
ctp_ has quit [Quit: Leaving...]
ZachBeta has quit [Quit: Computer has gone to sleep.]
ukwiz has joined #ruby
yugui_zzz is now known as yugui
jackiechan0 has quit [Ping timeout: 245 seconds]
kodcu has joined #ruby
<kodcu>
hi
jackiechan0 has joined #ruby
<kodcu>
Hi all
<Alantas>
Greetings and salutations.
<kodcu>
What is the future of Ruby
codebeaker has quit [Quit: codebeaker]
kodcu has left #ruby ["Leaving"]
cmarques has joined #ruby
<Alantas>
To crush its enemies, see them driven before it, and to hear the lamentation of their users.
stardiviner has joined #ruby
ZachBeta has joined #ruby
philcrissman has quit [Remote host closed the connection]
jwbuurlage has joined #ruby
stardiviner has left #ruby ["WeeChat 0.3.7"]
jwbuurlage has quit [Client Quit]
mdw has quit [Remote host closed the connection]
macer1 has joined #ruby
macer1 has quit [Changing host]
macer1 has joined #ruby
<macer1>
hi
<macer1>
how to use https proxy in net:http?
altiouz has joined #ruby
ping-pong has joined #ruby
<Alantas>
macer1: Combine the way of doing proxying with the way of doing https?
<macer1>
the proxy protocol is https
<macer1>
and I want to do http request using it
<macer1>
hmm
cdepue_ has joined #ruby
altious has quit [Ping timeout: 248 seconds]
<macer1>
anyway I am trying to use proxy(http proxy now) and it waits and prints my ip(trying to download cmyip.com) like there was no proxy active.
keanehsiao has quit [Quit: keanehsiao]
tayy has joined #ruby
cdepue has quit [Ping timeout: 246 seconds]
<Alantas>
If you're on 1.9.3, Net::HTTP has a :use_ssl parameter that can invoke HTTPS, and the docs say that Net::HTTP::Proxy has the same methods as Net::HTTP proper.
<macer1>
I tried this
<macer1>
and it doesn't have it
demet8 has joined #ruby
<macer1>
p = Net::HTTP::Proxy(proxy[:host], proxy[:port]); p.use_ssl = true
<macer1>
like that
<macer1>
but no method found...
punkrawkR has quit [Read error: Connection reset by peer]
<Alantas>
The HTTPS stuff has the example: NET::HTTP.start(uri.host, uri.port, :use_ssl => true).start do |http|
punkrawkR has joined #ruby
kalleth_ has quit [Read error: Operation timed out]
<macer1>
ok, start but start the connection to the page
<macer1>
not the proxy
<Alantas>
Oh, there's also a use_ssl=, like you trie.d
sc0_ has joined #ruby
<macer1>
https proxy, http page
topologist has quit [Remote host closed the connection]
mdw has joined #ruby
kalleth_ has joined #ruby
thone_ has joined #ruby
<Alantas>
What's version of Ruby you running? ("ruby -v" at the command line, or RUBY_VERSION within the language.)
<quuxman>
Alantas: are you really suggesting I parse them from the file instead of just using require?
<macer1>
when I change url to like blablabl;l;ad/, squid give me error page.
Chryson has quit [Quit: Leaving]
<macer1>
maybe it's like squid sending X-Real-IP header?
mdw has quit [Read error: Connection reset by peer]
mdw has joined #ruby
<codefarmer>
I have a simple array of numbers = [ 1, 3, 4, 6, 8, 9]. I would like to create a new_array of values based on an accuracy point.If the accuracy_point is 1, then new_array would look [ 1, 3, 4, 6, 8, 9]. If the accuracy_point is 3, then new_array would look [ 1, 3, 6, 9 ]. If the point is 5, then the array new_look [ 1, 5 ]. Does Ruby have anything standard to allow me to do this, or should i go ahead and write my own logic ? Are there any thi
<codefarmer>
Ruby that may help with writting this ?
kenperkins has quit [Quit: Computer has gone to sleep.]
<Mon_Ouie>
codefarmer: Enumerable#select
<codefarmer>
tx ill have a look now
heftig_ is now known as heftig
pika_pika has joined #ruby
schovi has quit [Read error: Connection reset by peer]
<codefarmer>
hmm, my question's data didn't cover all aspects. Enumerable#select selects items from within the array. However i would even need to create elements. so for example if the starting_array = [1, 3, 4, 5, 7, 9] and the accuracy_point is 2, then the new_array should = [ 1, 2, 4 ,6, 8, 10 ]
looopy has quit [Remote host closed the connection]
yugui is now known as yugui_zzz
<Mon_Ouie>
Just use modulo to check for that
otters has quit [Read error: Connection reset by peer]
weasels has joined #ruby
<codefarmer>
hmm tx i'll have a look at modulo now
<seanstickle>
Recommend you use __FILE__ in your directory path in the code.
<seanstickle>
Otherwise Dir will be running from the pwd of where it is included
<seanstickle>
*pwd -> cwd
christianrojas has joined #ruby
<becom33>
shevy, you here ?
<becom33>
seanstickle, still how can Include the module ?
<seanstickle>
Just require it.
<seanstickle>
Perhaps I misunderstand the question.
LBRapid has quit [Quit: Computer has gone to sleep.]
tommyvyo has joined #ruby
indeterminate has joined #ruby
yankov has joined #ruby
andrewhl has joined #ruby
<shevy>
becom33 didnt I show you before
<shevy>
include NameOfModule
<shevy>
if you work inside a class, use extend rather than include
<becom33>
shevy, the problem here is the NameOfModule is changed everytime
<Tasser>
becom33, require is for loading the files into the global namespace
sei has quit [Ping timeout: 260 seconds]
SeySayux has quit [Ping timeout: 260 seconds]
<Tasser>
becom33, ehh wtf?
jetblack has quit [Quit: leaving]
<shevy>
becom33 look. there are two ways.
<shevy>
(a) you either know the name of your module.
<shevy>
(b) you dont know the name of your module.
dnyy has quit [Remote host closed the connection]
<becom33>
b
<shevy>
if (b), then you can not use a module.
<shevy>
good. you cant include a module if you dont know its name. end of story.
<Tasser>
shevy, you can, if you have a variable containg that module
digitalcakestudi has joined #ruby
kalleth_ has quit [Ping timeout: 246 seconds]
petercs has joined #ruby
looopy has quit [Remote host closed the connection]
<shevy>
he wrote he does not know the name of the module
oponder has joined #ruby
<Tasser>
class Bar; mod = Module.new { def foo; :foo; end }; include mod; end
tommyvyo has quit [Ping timeout: 256 seconds]
<ged>
becom33: Do you control the contents of the modules? i.e., can you add a registration call to them?
<becom33>
Tasser, http://pastie.org/3935754 I use this to get modules . how can I know the each Module name inside each file
<Tasser>
becom33, you can't
mahmoudimus has joined #ruby
<becom33>
ged, Im not sure what are you asking .
<becom33>
well thats the problem
rdegraci has left #ruby [#ruby]
sei has joined #ruby
<ged>
becom33: I'm asking if you can add code to the modules you're loading.
jackiechan0 has quit [Ping timeout: 245 seconds]
<becom33>
ged, if your referning to mofifying the modules . yes I can
<ged>
becom33: If you can, you can make each of them call a registration hook when they load which adds them to an Array, then just include every object in that array.
<ged>
Then you don't need to know their names.
<becom33>
ged, if you don't mind can you gimme a short fast example code ?
SPYGAME has joined #ruby
tommyvyo has joined #ruby
wmoxam has joined #ruby
indeterminate has quit [Ping timeout: 244 seconds]
<ged>
becom33: Yep, writing one up now.
SeySayux has joined #ruby
troessner has joined #ruby
<codefarmer>
why does 1.0%0.1 = 0.09999999999999995 ? shouldn't it be 0 ?
<Mon_Ouie>
You should be aware of floating point arithmetics
Travis-42 has quit [Remote host closed the connection]
<Hanmac>
codefarmer whats your ruby version?? my returns this 1.0 % 0.1 => 0.0
<ged>
becom33: If you made the commands classes instead, you could use one of the builtin hooks like inherited() to do registration, but I can't think of any hooks for a Module.
<shevy>
you pass an argument, but do not do anything
<becom33>
value *
<shevy>
that is a bit better
<shevy>
but not 100% correct still
<shevy>
def foo=(i); @foo = i; end
<shevy>
def foo=(value); @foo = value; end
<shevy>
both are the same
<shevy>
becom33, you use this like:
<shevy>
cat.fur_colour = 'green'
<shevy>
understand?
<becom33>
yep
<shevy>
ok
<shevy>
last question. what is attr_accessor :foo doing
philcrissman has joined #ruby
<digitalcakestudi>
I'm trying to learn devise, I got the login working for the most part but the sign_out route is giving me a little problem. rake route shows that I have a action of destroy_user_session which I have a link_to "Sign Out", destroy_user_session_path in my app but when I go there I get No route matches [GET] "/users/sign_out"
<becom33>
read and write both . the way I read it
<shevy>
becom33 yeah. it combines attr_reader and attr_writer
zeromodu_ has joined #ruby
<shevy>
so you both have a getter method (read value) and a setter method (set value)
<digitalcakestudi>
I notice that the link_to is using a get vs the delete. How do I get the link to use use the Delete method?
<shevy>
digitalcakestudi hmm sounds a bit like rails question, the rail gurus happen to be on #rubyonrails. I for instance know nothing about rails, only about ruby
<digitalcakestudi>
oops sorry wrong chan
<digitalcakestudi>
:)
<shevy>
digitalcakestudi but perhaps someone else can respond to your question here, just letting you know
<shevy>
becom33, @@variables are bad in my opinion
<becom33>
simple plan remove one @
<shevy>
good
<shevy>
you should put that into a method though
<shevy>
in "def initialize" for instance
<shevy>
I myself use "def reset" usually, and call that from within initialize
zeromodulus has quit [Ping timeout: 246 seconds]
philcrissman has quit [Remote host closed the connection]
<becom33>
shevy, in a another module can't I do Execution::command = "banner" and add banner to that array ?
tomzx has joined #ruby
<shevy>
which array
<becom33>
command = []
<becom33>
@command = []
<becom33>
*
<shevy>
you can add something to an array via
<shevy>
@array << foo
<shevy>
so in your example
<shevy>
@command << foo
<becom33>
i did this in in my Banner module. doesnt seems to work :/
<becom33>
Help.command << "banner"
<shevy>
what the heck is Help.command
<shevy>
you could define such a method via
<shevy>
def self.command
arbipher has joined #ruby
<shevy>
and have that return @command
luckyruby has quit [Remote host closed the connection]
<arbipher>
JOIN #irc
<becom33>
shevy, in another module
<becom33>
shevy, I'm trying to auto generate a help command with all the modules I write
arbipher has left #ruby [#ruby]
<becom33>
so in modules for a example Banner
Vert has joined #ruby
<becom33>
I could do
<becom33>
module Banner
<becom33>
def initialize
<becom33>
Help.command << "banner"
<becom33>
end
<becom33>
require 'lib/help' # in the top I missed it
<shevy>
god I just hate modules
<becom33>
shevy, you gave me the code with modules :/
<shevy>
I am sure you never defined Help.command anywhere
<shevy>
no
<shevy>
well yeah
<shevy>
but you want to use modules
<shevy>
I told you to not do that
Morkel has joined #ruby
<becom33>
shevy, what else would I do ?
<shevy>
and btw
<shevy>
module Foo; def initialize
<shevy>
I am sure I never wrote that because you can not instantiate a module
Ontolog has joined #ruby
<shevy>
the problem is, you want to jump from zero to complicated, without making the steps in between
<becom33>
ok I didnt know that :/
r0bby has joined #ruby
<becom33>
alright alright I missed some stuff .
tommyvyo has joined #ruby
flopper has joined #ruby
defendguin has joined #ruby
MetaCosm has quit [Read error: Operation timed out]
davidboy has quit [Read error: Operation timed out]
kapowaz has quit [Read error: Operation timed out]
robbyoconnor has quit [Ping timeout: 246 seconds]
<subr00t>
I spent many hours looking for a good tutorial on how to build a cloud server analytics system for aws (or any approach),can some one please mention a link?
khakimov has joined #ruby
<defendguin>
i've always used ruby along with ruby on rails but now i would like to build a plan ruby script to harvest information from the interwebs using rdig. Is there a good resource for how to set up a normal ruby project?
relix has quit [Ping timeout: 245 seconds]
_marvin has quit [Ping timeout: 252 seconds]
pureluck_ has quit [Ping timeout: 240 seconds]
Dr4g has quit [Ping timeout: 245 seconds]
jrgifford has quit [Ping timeout: 272 seconds]
SeanTAllen has quit [Ping timeout: 272 seconds]
xrl has quit [Ping timeout: 272 seconds]
ciopte7_ has quit [Quit: ciopte7_]
IPGlider has quit []
pkondzior has quit [Ping timeout: 246 seconds]
fcoury has quit [Max SendQ exceeded]
ZachBeta has joined #ruby
ipoval has joined #ruby
anildigital_work has quit [Max SendQ exceeded]
denysonique has quit [Ping timeout: 256 seconds]
dkannan has quit [Ping timeout: 272 seconds]
si14 has quit [Ping timeout: 272 seconds]
JC_SoCal has quit [Ping timeout: 272 seconds]
ziyadb has quit [Max SendQ exceeded]
patricksroberts has quit [Ping timeout: 245 seconds]
ZachBeta has quit [Quit: Computer has gone to sleep.]
davidboy has joined #ruby
<defendguin>
jackiechan0: use pastie.org or some other similar site. don't paste in here
mockillo has quit [Ping timeout: 252 seconds]
DMKE has quit [Ping timeout: 265 seconds]
mockillo has joined #ruby
<jackiechan0>
defendguin> sorry was a mistake
relix has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
<jackiechan0>
nobody here?
amar_key has quit [Max SendQ exceeded]
yankov has quit [Read error: Connection reset by peer]
relix has quit [Max SendQ exceeded]
<defendguin>
you still haven't pasted anything
berserkr has joined #ruby
yankov has joined #ruby
jrgifford has joined #ruby
truedon has joined #ruby
<truedon>
hey guys I am trying to install redmine and get the webrick start on centos 6 but i keep getting this error about iconv and I can't figure out what to do next
<macer1>
hmm I have string like "123.123.123.123:8888" and trying to do line.split(/:/).each do |host, port| but all go to host and port is nil. why?
denysonique has joined #ruby
wmoxam has quit [Ping timeout: 248 seconds]
<seanstickle>
macer1: Because doing |host,port| doesn't let you just grab 2 items from an array that might have more than 2 elements.
denysonique has quit [Read error: Operation timed out]
Ryan52 has joined #ruby
Spaceghostc2c has quit [Read error: Operation timed out]
<virunga>
macer1: because split returns an array and each permits the iteration on a single element for time
<macer1>
[line.delete("\n").split(/:/)].each do |host, port| works like that
<macer1>
thanks anyway :)
<seanstickle>
That looks crazy unmaintainable!
<seanstickle>
Good luck,
ciopte7 has joined #ruby
<sepp2k>
macer1: Why don't you just do host, port = line.split(/:/) ?
<Boohbah>
truedon: looks like the installer is not finding your gem directory
<sepp2k>
Creating a one-element array just to call each on it, is just insane.
<macer1>
makes sense
looopy has joined #ruby
<Ryan52>
Hi, I'm trying to find a way to undefine a class. Is that possible? I have a bug in some code that is a bit too convoluted to debug, but I think I might be able to solve it using this.
philcrissman has quit [Remote host closed the connection]
<otherj>
seanstickle: btw, ended up just changing my date formatting to use - ;o)
<codefarmer>
how can i beter write this in ruby https://gist.github.com/2731799 . i want to declare val2 to equal val1 unless val1 is smaller than 0.1 ?
<jackiechan0>
shevy> correct? then i'll go ahead studying
SmoothSage has quit [Quit: Leaving]
<shevy>
jackiechan0 if you use #{} you dont need the .to_i
<shevy>
and no, this is not correct
<shevy>
I told you before
jgrevich has quit [Quit: jgrevich]
<shevy>
<shevy> use #{} in strings
<shevy>
<shevy> x = 5; "foo #{x}"
<shevy>
here I showed you how to use it
<shevy>
jackiechan0 the output of number.to_i + 1 will be the same in both examples, yes
looopy has joined #ruby
<shevy>
but it is still not the same thing, and
<jackiechan0>
shevy> ok i'll work on it, thanks for suggesting me the Cris Pine it's really good
jcromartie has quit [Client Quit]
<shevy>
(number.to_i+1) will return a Fixnum
<heftig>
shevy: still needs the to_i
Ontolog has quit [Remote host closed the connection]
<jackiechan0>
shevy> yeah it's true
<heftig>
however, it won't need a to_s
<becom33>
umm so like before we have modules like Banner (i know you hate modules) . I want to make a auto help command from like Banner . so I do somthing like in 'trollops' they have ' opt :src, "src lang", :short => 'i', :type => String' and they automatially generates the -h(help)
<Tasser>
shevy, http://sprunge.us/IKBh and have fun with Object.create javascript style ;-)
ph^ has joined #ruby
azm has joined #ruby
azm has quit [Changing host]
azm has joined #ruby
<jackiechan0>
Hanmac> really?
<jackiechan0>
Hanmac> +1 = string + 1 = number ?
mneorr has quit [Ping timeout: 246 seconds]
Morkel has quit [Quit: Morkel]
<Hanmac>
no "number.to_i +1" is bad
<Hanmac>
"number.to_i+1" or "number.to_i + 1" are good
<jackiechan0>
Hanmac> mixing.rb:41:in `+': can't convert Fixnum into String (TypeError)
Icehawk78 has quit [Remote host closed the connection]
<jackiechan0>
Hanmac> i used number.to_i + 1
jimeh2 has quit [Ping timeout: 248 seconds]
<Hanmac>
hm that shounldt be, that error
ConstantineXVI has joined #ruby
truedon has quit [Quit: truedon]
ZachBeta has quit [Quit: Computer has gone to sleep.]
<jackiechan0>
i'm trying to do this exercize Write a program which asks for a person's favorite number. Have your program add one to the number, then suggest the result as a bigger and better favorite number. (Do be tactful about it, though.)
mneorr has joined #ruby
h4mz1d has joined #ruby
fgwaegeawgfwa has quit [Ping timeout: 244 seconds]
jimeh2 has joined #ruby
d3c has quit [Ping timeout: 265 seconds]
novodinia has quit [Ping timeout: 276 seconds]
macer1 has joined #ruby
khakimov has quit [Quit: Computer has gone to sleep.]
havenn has joined #ruby
davidpk has quit [Ping timeout: 252 seconds]
jniesen has joined #ruby
<td123>
jackiechan0: you mean lik , puts 'fav num?';puts('your new fav num:', gets.to_i + 1)
<jackiechan0>
td123> yeah :)
<jackiechan0>
td123> it makes me crazy i dunno why!
<td123>
which part are you having trouble with?
<jackiechan0>
td123> here are the variables
<jackiechan0>
number=gets.chomp
<jackiechan0>
fav=number.to_i+1
<jackiechan0>
what's wrong ?
<jackiechan0>
i got this error mixing.rb:42:in `+': can't convert Fixnum into String (TypeError)
<Hanmac>
mixing ... is that one of your files?
<jackiechan0>
oh gosh i forgot ''
<td123>
jackiechan0: works for me
<jackiechan0>
td123> ?!?
rboyd has quit [Quit: rboyd]
<jackiechan0>
td123> can u paste that to me ?
<td123>
[15] pry(main)> num = gets.chomp
<td123>
1
<td123>
[16] pry(main)> fav =num.to_i+1
<td123>
=> 2
Jade has quit [Ping timeout: 244 seconds]
khakimov has joined #ruby
davidpk has joined #ruby
vertroa has joined #ruby
jniesen has quit [Quit: Leaving.]
exchgr has joined #ruby
philcrissman has quit [Remote host closed the connection]
ZachBeta has quit [Read error: Connection reset by peer]
quesada_ has quit [Remote host closed the connection]
Targen has joined #ruby
quesada_ has joined #ruby
ZachBeta has joined #ruby
digitalcakestudi has quit [Remote host closed the connection]
amalvagomes_ has joined #ruby
markjwlee has joined #ruby
ciopte7__ has joined #ruby
<markjwlee>
Hi everyone... I'm currently running a server program using bundle exec... what would be the best way to get the program to run as a service on startup?
adeponte has quit [Remote host closed the connection]
<markjwlee>
(I'm on CentOS 5)
fukushima has joined #ruby
sebastorama has quit [Ping timeout: 240 seconds]
fukushima has quit [Client Quit]
deobald__ has quit [Ping timeout: 260 seconds]
amalvagomes has quit [Ping timeout: 246 seconds]
amalvagomes_ is now known as amalvagomes
Urthwhyte is now known as Urth|Away
Urth|Away is now known as Urthwhyte
jackiechan0 has quit [Quit: Sto andando via]
<offby1>
not sure. But perhaps you can use the "reboot" keyword in "cron"
<macer1_>
.
<macer1_>
how can I connect to https proxy with ruby ;/
Eldariof27-ru has quit [Read error: Operation timed out]
minijupe has joined #ruby
mlevin_ has joined #ruby
cordoval has joined #ruby
azm has quit [Ping timeout: 246 seconds]
palmfrond has joined #ruby
danblick has quit [Quit: Leaving.]
bontaq has joined #ruby
codefarmer has quit [Ping timeout: 260 seconds]
rboyd has quit [Quit: rboyd]
cordoval has quit [Client Quit]
deryldoucette has joined #ruby
nari__ has joined #ruby
Urthwhyte is now known as Urth|Away
deryldoucette has quit [Client Quit]
tayy_ is now known as tayy
schovi has quit [Remote host closed the connection]
deryldoucette has joined #ruby
tayy has quit [Remote host closed the connection]
dnyy has joined #ruby
ZachBeta has quit [Quit: Computer has gone to sleep.]
bondar has joined #ruby
bondar has quit [Excess Flood]
jondot_ has joined #ruby
<jondot_>
trying to resolve 2 libraries conflicting class names
<jondot_>
if i'm requiring 'rbconfig' which defines 'Config' and then another library requires and imports Some::NS::Config into the scope, how would just Config be interpreted?
Guest38008 has quit [Read error: Operation timed out]
xerophyte has quit [Ping timeout: 260 seconds]
rippa has quit [Ping timeout: 245 seconds]
Morkel has joined #ruby
Morkel has quit [Client Quit]
bluenemo has quit [Read error: Connection reset by peer]
otters has quit [Read error: Connection reset by peer]
rboyd has joined #ruby
codebeaker has joined #ruby
otters has joined #ruby
sparrovv has quit [Ping timeout: 250 seconds]
pu22l3r has joined #ruby
sparrovv has joined #ruby
Urth|Away is now known as Urthwhyte
diegoviola has joined #ruby
Gavilan has joined #ruby
nari__ has quit [Ping timeout: 244 seconds]
Gavilan is now known as Gavilan2
quesada__ has joined #ruby
cdepue has quit [Ping timeout: 276 seconds]
sepp2k has quit [Ping timeout: 246 seconds]
codebeaker has quit [Quit: codebeaker]
niklasb has joined #ruby
igotnolegs has joined #ruby
quesada_ has quit [Ping timeout: 260 seconds]
<troessner_>
jondot_, you should be ok since the second one is namespaced
<jondot_>
troessner_, found the problem, jruby specific. thanks
<troessner_>
np
<troessner_>
:-)
griffindy has joined #ruby
vertroa has quit [Read error: Connection reset by peer]
cdepue has joined #ruby
inteq has joined #ruby
rboyd has quit [Quit: rboyd]
macmartine has quit [Quit: macmartine]
<apeiros_>
jondot_: newer rubys have rbconfig under the constant RbConfig
<apeiros_>
just use that
<jondot_>
thanks for the tip
zeromodu_ has quit [Remote host closed the connection]
kirun has joined #ruby
codefarmer has joined #ruby
cdepue has quit [Ping timeout: 244 seconds]
dhaskew_ has joined #ruby
dhaskew has quit [Read error: Connection reset by peer]
dhaskew_ is now known as dhaskew
<markjwlee>
Hi everyone... I'm currently running a server program using bundle exec... what would be the best way to get the program to run as a service on startup? (I'm running CentOS 5.7)
Soda has joined #ruby
sp3ctr has quit []
dhaskew has quit [Read error: Connection reset by peer]
senny has quit [Remote host closed the connection]
ArtificialEX has joined #ruby
Nollo has quit [Ping timeout: 245 seconds]
<apeiros_>
Nollo: try in #rvm, they're quite responsive
<ArtificialEX>
hey, im working on a project and my partner is adamant about using RoR Canvas for a classroom environment ( it does look good ). I only know PHP, and am in charge of building the rest of the site , and they like what I've done in PHP. Would it be a huge deal to have RoR and PHP talk to the same db and integrate seamlessley enough?
<apeiros_>
ArtificialEX: if you can live with a couple of conventions on table/column naming, that should be no problem
khakimov has joined #ruby
zeromodu_ has joined #ruby
<ArtificialEX>
thanks apeiros_, im fairly comfertable with java and c#, so im wondering if i should just learn ruby for the sake of this project
<offby1>
So. Freezing. I am using arrays as hash keys. It occurs to me that it might be a good idea to freeze each such array as soon as I create it. Any opinions either way?
fr0gprince_mac has quit [Quit: Leaving...]
dchelimsky has quit [Remote host closed the connection]
ZachBeta has quit [Quit: Computer has gone to sleep.]
<offby1>
ArtificialEX: I found ruby quite easy to learn, but then I knew perl and python very well; all three are quite similar. C# and java are both a bit different, if for no other reason than that they're statically typed (and require a compilation pass)
<offby1>
but I don't know either so I can't compare 'em to ruby
<ArtificialEX>
well im most used to PHP. right now I am really enjoying laravel framework :/
<offby1>
I suspect ruby is more similar to PHP than to C# or java, but ... I don't know PHP either :)
<ArtificialEX>
anyone use canvas or a RoR learning environment?
iamjarvo has quit [Ping timeout: 244 seconds]
jniesen has joined #ruby
Soda has quit [Quit: fuck you guys, im go home]
jniesen has left #ruby [#ruby]
Soda has joined #ruby
ZachBeta has joined #ruby
c0rn has joined #ruby
Urthwhyte is now known as Urth|Away
rh1n0 has joined #ruby
Azure is now known as DJZuzu
ConstantineXVI has joined #ruby
jd has joined #ruby
c0rn has quit [Ping timeout: 245 seconds]
dchelimsky has joined #ruby
henn1nk has joined #ruby
c0rn has joined #ruby
<henn1nk>
i have several lines like this: session[:marque] = params[:marque] ... can i shorten this?
Jade has quit [Ping timeout: 252 seconds]
<henn1nk>
session[#{option}] = params[#{option}] or so?
RudyValencia has quit [Read error: Connection reset by peer]
RudyValencia has joined #ruby
soulcake has joined #ruby
<shevy>
ewww
<shevy>
henn1nk #{} is typically used in strongs
<shevy>
bar = 5; "foo #{bar}"
<shevy>
sorry
<shevy>
typically used in *strings
sepp2k has quit [Remote host closed the connection]
<henn1nk>
shevy: yes of course, you are right. but is there a way to shorten this?
<shevy>
session[:marque] = params[:marque]
<henn1nk>
for x in [:marque, :cars, ...] do
<shevy>
wait
r3t0dd has quit [Quit: Leaving]
<shevy>
if you need to use for / in
<shevy>
then you can always use an array, and apply .each
otters has quit [Read error: Connection reset by peer]
LBRapid has joined #ruby
ryanf has joined #ruby
delinquentme has joined #ruby
kaspernj has quit [Ping timeout: 246 seconds]
<delinquentme>
is it too general of a question to ask whether ruby or JS is faster with floating point calculations?
Foxandxss has joined #ruby
alveisan has joined #ruby
alveisan has left #ruby [#ruby]
davidboy has joined #ruby
<seanstickle>
For a program modeling intersections of hyperspheres in 1800-dimensional space?
<seanstickle>
I'd go with Ruby, myself.
vitor-br has joined #ruby
<ryanf>
really? I would have thought v8 would be faster for that kind of thing
<ryanf>
for no particular reason
<ryanf>
marketing maybe
<seanstickle>
Ah, but you're forgetting the really excellent gem for doing hyperdimensional calculations
<shevy>
henn1nk, for .select see this here: {:x => 1, :y => 2}.select {|key, value| value > 1} # => [[:y, 2]]
<seanstickle>
Which is, I believe, written mostly in C
ikaros has quit [Quit: Ex-Chat]
jd is now known as Jade
<shevy>
henn1nk here, we selected for those subgroups of the hash, for which the condition "value larger than 1" is true
<Veejay>
seanstickle: V8 is faster than C
<shevy>
whereas with .each you simply iterate over all elements of a collection
looopy has quit [Remote host closed the connection]
vertroa has quit [Ping timeout: 246 seconds]
<Veejay>
Because V8 is written in Node.js
<Veejay>
The calculations are non-blocking
<seanstickle>
Veejay: not just normal C though
<seanstickle>
Veejay: hyperdimensional C
<seanstickle>
So it calculates in multiple universes simultaneously
<Veejay>
Is it asynchronous though?
<seanstickle>
No, it is multi-universe synchronoous
<Veejay>
Ah
<seanstickle>
Otherwise you have re-entrant problems in subspace
<seanstickle>
Oddly enough, this conversation is what people talking about programming sounded like to me about 15 years ago.
<Veejay>
heh
Soda has quit [Quit: fuck you guys, im go home]
<ryanf>
haha
<Veejay>
Oddly enough, this conversation sounds like any Node zealot preaching to newbies just how Node.js will solve every programming problem known to man, measles and cancer
<Veejay>
And then some
savage- has joined #ruby
<seanstickle>
Particularly when we now have outstanding PHP reactors like