djbkd has quit [Remote host closed the connection]
djbkd has joined #ruby-lang
RobertBirnie has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
djbkd has quit [Remote host closed the connection]
djbkd has joined #ruby-lang
sepp2k1 has joined #ruby-lang
charliesome has joined #ruby-lang
sepp2k has quit [Ping timeout: 240 seconds]
seamon has quit [Quit: Zzzzzzz]
toastynerd has quit [Remote host closed the connection]
tmegano has quit [Ping timeout: 240 seconds]
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
toastynerd has joined #ruby-lang
seamon has joined #ruby-lang
amsi has quit [Quit: Leaving]
mistym has quit [Read error: Connection reset by peer]
toastynerd has quit [Remote host closed the connection]
womble` is now known as womble
emmesswhy has quit [Quit: This computer has gone to sleep]
toastynerd has joined #ruby-lang
mistym has joined #ruby-lang
allomov has joined #ruby-lang
toastynerd has quit [Remote host closed the connection]
allomov has quit [Ping timeout: 245 seconds]
yyyy1313 has joined #ruby-lang
<yyyy1313>
Hello, I'm new to using Ruby. I was wondering if anyone would be willing to spend a little bit of time trying to explain how to properly use a class and what it means to trying to have the results of a method from one class to be moved over to another method within said class.
|jemc| has joined #ruby-lang
<bnagy>
yyyy1313: have you ever programmed before?
<yyyy1313>
I'm new to programming, I been reading various books to get up to speed. Been reading for about a month and I get a lot of the concepts behind creating a program globally. But via the constraints of a class that I create it has broken my mind.
_Kerber0s_ has joined #ruby-lang
<yyyy1313>
Some of the sources I been using has been learn to code the hard way, Beginning Ruby_From_Novice_to_Professional, and learn 2 Program 2nd edition.
_Kerber0s_ has quit [Remote host closed the connection]
_Kerber0s_ has joined #ruby-lang
<bnagy>
well it might be better if you asked specific questions based on the examples from one of those. Hardway has all the exercises online.
Kerber0s has quit [Ping timeout: 260 seconds]
<bnagy>
or if you explain what you think 'classes' 'objects' and 'methods' are
<yyyy1313>
Well I'll post just something I was messing around with
<bnagy>
ok, pasting into IRC is bad. Use gist or pastie or something
<yyyy1313>
Oh my bad
<yyyy1313>
It was just a few lines so didn't think it would be too bad.
<bnagy>
well 2 lines is the 'standard' polite limit :)
<yyyy1313>
Ok, will do won't do it again. Sorry about that. Haven't really used IRC in forever, so wasn't famillar with the etiquette
<bnagy>
so that code is gibberish
earthquake has quit [Quit: earthquake]
jgpawletko has quit [Quit: jgpawletko]
<yyyy1313>
I just wanted to create a quick method to calculate probability and was just using random names for the time being. But the issue I'm having with it is I wanted to create a new method that took the result from calculation_probability and calculated another set of results from that method. The @result = return result was just something I added trying to see if I could get it to work on another
<yyyy1313>
method I was going to create.
lsegal has joined #ruby-lang
<bnagy>
start simpler
<bnagy>
start by thinking about what classes and objects are
amerine has quit [Ping timeout: 240 seconds]
<yyyy1313>
well I get the idea behind a class has a method or is-a part of a larger class.
<bnagy>
because if it isn't something with some kind of state ( properties or attributes, or data, or whatever ) AND some kind of behaviour ( methods whatever ) then it probably shouldn't be represented as classes / objects
sharpmachine has quit [Remote host closed the connection]
yatish27 has quit [Ping timeout: 245 seconds]
<bnagy>
data containers with no special behaviour -> use a standard type ( Array etc ) behaviour with no state -> use a Module
esmet_ has quit [Quit: Connection closed for inactivity]
yatish27 has joined #ruby-lang
<yyyy1313>
Oh man, I thought a class had to encompass everything, lol.
<yyyy1313>
Do you recommend any material that can help reinforce this idea?
<bnagy>
bad abstraction is a fairly common problem, imho it just comes from cargo-culting code
<harly>
work through them. plenty of searchable help online, it mostly hints you the answers, and teaches you some basic elements of ruby.
parenjitsu has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<yyyy1313>
@bnagy what do you mean by cargo-culting?
<yyyy1313>
@harly will definitely start working on it tonight see if it can help.
<bnagy>
writing code based on copying other code that is not fully understood
<yyyy1313>
Right actually let me link you the material and I can read some of the idea behind it, but it just hasn't quite clicked yet.
<yyyy1313>
@bgnagy http://pastie.org/9522913 so this is one of the examples of trying to create a game with a room player with certain attributes. When trying to go line by line it completely broke my mind.
<harly>
you should probably start with something more basic. ruby syntaxes. and then introductions to modules, classes, objects etc.
<bnagy>
that's a pretty reasonable OO example
<harly>
it's a complex OO example, for someone who knows no OO :)
<bnagy>
and it's good that it's written in a very straightforward manner. What's not clear?
<harly>
it's a basic game example :)
<yyyy1313>
Well I been doing the basic work such as looping, creating global methods, using iterators and true and false statements. I also been using codeacademy to sink in other facets.
<yyyy1313>
But when I got to this part in the book it just blew my mind completely.
<harly>
looping, globals, iterators etc are ultra basic. next steps is to get a hold of modules and classes. but with examples that are focused on teaching that with simple examples, not relatively complex ones.
<yyyy1313>
for example I don't quite understand why initialize is needed to begin the whole chain of commands. And I don't even understand how some of the methods are linked with others. I don't even get how the player character is even moving.
<harly>
the koans would be a better start.
<bnagy>
what if you started with just the Player class, then made a couple of Players and messed around with them?
<harly>
and if in the koans you found something you didn't understand, it's very obvoius from context what stuff you should google to get a better grasp.
jbardin has quit [Quit: jbardin]
<yyyy1313>
Ok, I'll give the koan a go.
<bnagy>
yyyy1313: you should also start working with basic examples in irb. It really clarifies things when you get an instant response to every line
<harly>
initialize is just the place where object variables are set up. It's called automatically after new is called to create the object. in this instance it's automatically dcreating a player object and storing it as an object variable (using the string parameter as the player name), and initialising rooms to be an empty array. that's why the code at the bottom creates a new dungeon passing a name as a parameter, and then sets up rooms.
<harly>
but again, it's a complex exmaple to learn the basics.
karamazov has joined #ruby-lang
yatish27_ has joined #ruby-lang
mistym has quit [Remote host closed the connection]
yatish27 has quit [Ping timeout: 240 seconds]
hahuang65 has quit [Ping timeout: 260 seconds]
<yyyy1313>
so initialize just holds the instance that's created from Dungeon.new
<harly>
the class holds them. initialize just sets them up.
yatish27 has joined #ruby-lang
<harly>
the object holds them rather.
haraoka has joined #ruby-lang
<yyyy1313>
Ah, ok. Alright let me give this Koan program a shot. I'll be back in a week if I have any issues getting it. Thanks for the link.
<harly>
the koans is a good start. that code assumes knowledge of classes, object instantiation, object methods, object variables, string concatenation, attr_accessors, symbols, etc. the koans will teach you that. then it will be easier to see what it's doing.
<yyyy1313>
Awesome. That's exactly what I need!
yatish27_ has quit [Ping timeout: 252 seconds]
seamon has quit [Quit: Zzzzzzz]
tkuchiki has joined #ruby-lang
bsvineeth has joined #ruby-lang
Newbie0086 has joined #ruby-lang
yatish27 has quit [Ping timeout: 252 seconds]
bsvineeth has quit [Ping timeout: 240 seconds]
yatish27 has joined #ruby-lang
ender|dkm has joined #ruby-lang
houhoulis has joined #ruby-lang
ender|dkm has quit [Ping timeout: 264 seconds]
migbar_ has quit [Remote host closed the connection]
<yorickpeterse>
That means you just overwrote your system Ruby
<yorickpeterse>
Which can potentially break it
<yorickpeterse>
(it being Debian)
<ZAJDAN>
mine goal was keep debian 6 without upgrade
<ZAJDAN>
and install ruby and rails from repository
<yorickpeterse>
You might've very well just hosed it, though I'm not sure up to what extend Debian uses Ruby for stuff
<ZAJDAN>
now I know when keep debian 6 I can not install ruby from his repository but must Building from Source
<sarkyniin>
hey, I'm using valkyrie to transfer an sqlite db to a pg one
<sarkyniin>
however, when I execute this command: valkyrie SQLite://pokedex.sqlite postgres://localhost/pokedex
<sarkyniin>
it gives me this error: usr/local/lib/ruby/gems/2.1.0/gems/sequel-3.31.0/lib/sequel/adapters/postgres.rb:231:in `initialize': PG::ConnectionBad: fe_sendauth: no password supplied (Sequel::DatabaseConnectionError)
<sarkyniin>
is there an easy way to fix this?
<yorickpeterse>
sarkyniin: Yes, supply a password when connecting to Postgres
<yorickpeterse>
The error literally tells you to
<sarkyniin>
yorickpeterse: but I didn't set a password when creating the db/role
<yorickpeterse>
apparently you did, otherwise it wouldn't ask for one
<yorickpeterse>
also I don't see a user in that postgres:// string, so make sure that's set up properly too
<yorickpeterse>
sarpk92: change <div id="map" to <div id="map_canvas"
ianmcshane has joined #ruby-lang
<sarpk92>
I did the gemfile thing and bundle install + //= require gmap3 to application.js
<yorickpeterse>
also the extra parenthesis around the Javascript are not needed
<[spoiler]>
The ( and ) are superfluous in this context, but you should call <%= javascript_include_tag "http://maps.googleapis.com/maps/api/js?sensor=true" before the call to $("#map_canvas").gmap3(); (if google maps implements it)
<[spoiler]>
This isn't really a Ruby (or even Rails) related question.
<sarpk92>
Does the order matter?
<[spoiler]>
Yes, the order is very important
<sarpk92>
I put it at the end
<sarpk92>
oh
havenwood has joined #ruby-lang
<sarpk92>
C'mon this is ruby not ANSI C
<sarpk92>
WOW
<sarpk92>
IT WORKS!
<[spoiler]>
No, this is JavaScript
<[spoiler]>
:P
<sarpk92>
Order really matters
<sarpk92>
So can I do this in rails
<sarpk92>
or do I have to use these div stuff
<sarpk92>
I mean with ruby code
<[spoiler]>
Rails is a backend framework, so you will need to use JavaScript
<yorickpeterse>
sarpk92: Do you mean generating HTML?
<sarpk92>
yeah
<sarpk92>
you know <% %> kind of stuff
<yorickpeterse>
sarpk92: sort of, Rails uses ERB by default (that) but you can also use other languages
<yorickpeterse>
(e.g. HAML)
<[spoiler]>
Well, you could use a HTML-generator DSL, but I don't see the point
<sarpk92>
like <% do_some_div_stuff(map_canvas) %>
<[spoiler]>
This is a view/template; writing HTML (and ERB) or using some other templating language is expected of you. There's no point in wrapping it all up inside a method. You could, I suppose, create a partial
<[spoiler]>
if the map appears on many places
<yorickpeterse>
sarpk92: you'd have to write Ruby code for it yourself in this case
<sarkyniin>
hey, when using taps, I get this error
<sarkyniin>
"/usr/local/lib/ruby/gems/2.1.0/gems/sequel-3.20.0/lib/sequel/adapters/postgres.rb:175:in `async_exec': PG::DatatypeMismatch: ERROR: column "is_base" is of type boolean but expression is of type integer (Sequel::DatabaseError)
Kerber0s has quit [Remote host closed the connection]
Kerber0s has joined #ruby-lang
chouhoulis has quit [Ping timeout: 260 seconds]
Forgetful_Lion has quit [Remote host closed the connection]
kgrz has quit [Ping timeout: 245 seconds]
enkristoffer has quit [Quit: ❤]
nofxx__ has joined #ruby-lang
tdy has joined #ruby-lang
itsraining has joined #ruby-lang
loincloth has joined #ruby-lang
enkristoffer has joined #ruby-lang
ledestin_ has quit [Ping timeout: 245 seconds]
cmhobbs has joined #ruby-lang
cmhobbs has joined #ruby-lang
cmhobbs has quit [Remote host closed the connection]
cmhobbs has joined #ruby-lang
cmhobbs has joined #ruby-lang
cmhobbs has quit [Changing host]
ledestin has joined #ruby-lang
ianmcshane has quit [Remote host closed the connection]
kek_ has joined #ruby-lang
yfeldblum has joined #ruby-lang
amerine has joined #ruby-lang
relix has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
kek has quit [Ping timeout: 260 seconds]
Sphynx has quit [Remote host closed the connection]
yfeldblum has quit [Ping timeout: 240 seconds]
amerine has quit [Ping timeout: 240 seconds]
enkristoffer has quit [Quit: ❤]
bsvineeth has quit [Remote host closed the connection]
ledestin_ has joined #ruby-lang
ledestin has quit [Ping timeout: 276 seconds]
ledestin_ is now known as ledestin
enkristoffer has joined #ruby-lang
<darix>
ZAJDAN: install openssl devel files before compiling ruby or keep using your distro packages if you have no clue what you are doing.
enkristoffer has quit [Changing host]
enkristoffer has joined #ruby-lang
<darix>
yorickpeterse: unless chruby/ruby-install also install openssl for him (which i really really hope they wont), using this tools will give him just as broken as ruby installs as he has atm.
eddiezane_zzz is now known as eddiezane
<yorickpeterse>
darix: ruby-install uses your package manager to install system level dependencies, if available
<yorickpeterse>
it doesn't compile stuff from source
eddiezane is now known as eddiezane_zzz
<darix>
yorickpeterse: i was wondering about oga ... should you remove the pure ruby part from the description now that it has a ragel based parser?
chouhoul_ has quit [Remote host closed the connection]
toastynerd has joined #ruby-lang
<yorickpeterse>
darix: it's not part of the description anymore, for quite some time now
<darix>
ok
chouhoulis has joined #ruby-lang
<darix>
yorickpeterse: is there a gem release already? then i could quickly put it into a package :)
momomomomo has joined #ruby-lang
<yorickpeterse>
Not yet, also wtf you want to package it already?
<darix>
well if there was a gem ... i could with like 20s of work :p
ZAJDAN has quit [Read error: Connection reset by peer]
enkristoffer has quit [Quit: ❤]
<darix>
and i usually try to avoid installing things outside of rpms :)
ZAJDAN has joined #ruby-lang
<darix>
yorickpeterse: and i finally fixed rbx support for it
havenwood has joined #ruby-lang
|jemc| has quit [Ping timeout: 272 seconds]
toastynerd has quit [Remote host closed the connection]
mistym has joined #ruby-lang
kek_ has quit [Remote host closed the connection]
ender|dkm has joined #ruby-lang
mistym has quit [Remote host closed the connection]
ender|dkm has quit [Ping timeout: 264 seconds]
tdy has quit [Ping timeout: 245 seconds]
nofxx__ has quit [Ping timeout: 245 seconds]
thagomizer has joined #ruby-lang
kgrz has joined #ruby-lang
cmhobbs has quit [Remote host closed the connection]
|jemc| has joined #ruby-lang
cmhobbs has joined #ruby-lang
AKASkip has quit [Ping timeout: 268 seconds]
ledestin has quit [Ping timeout: 245 seconds]
vikasyaligar has joined #ruby-lang
vikasyaligar has left #ruby-lang [#ruby-lang]
<yorickpeterse>
Not sure why you'd want to install oga outside of RubyGems at this point though
mistym has joined #ruby-lang
<yorickpeterse>
at least not until 1.0
cmckee has joined #ruby-lang
karamazov has joined #ruby-lang
ledestin has joined #ruby-lang
solars has quit [Ping timeout: 246 seconds]
yfeldblum has joined #ruby-lang
tdy has joined #ruby-lang
CaptainJet has joined #ruby-lang
yfeldblum has quit [Ping timeout: 272 seconds]
Phrogz has joined #ruby-lang
amerine has joined #ruby-lang
momomomomo has quit [Ping timeout: 246 seconds]
momomomomo has joined #ruby-lang
kgrz has quit [Remote host closed the connection]
fusillicode has quit [Quit: Leaving.]
fusillicode1 has joined #ruby-lang
amerine has quit [Ping timeout: 260 seconds]
fusillicode1 has quit [Read error: Connection reset by peer]
fusillicode has joined #ruby-lang
qba73 has quit []
io_syl has joined #ruby-lang
karamazov has quit [Remote host closed the connection]
kgrz has joined #ruby-lang
karamazov has joined #ruby-lang
banister has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
konr has quit [Quit: Connection closed for inactivity]
bsvineeth has joined #ruby-lang
Miphix has quit [Quit: Leaving]
relix has joined #ruby-lang
necro has joined #ruby-lang
kek has joined #ruby-lang
kek has quit [Ping timeout: 246 seconds]
_whitelogger__ has joined #ruby-lang
jinie has joined #ruby-lang
toastynerd has joined #ruby-lang
wallerdev has joined #ruby-lang
valeri_uF0 has joined #ruby-lang
emmesswhy has joined #ruby-lang
manveru_ has joined #ruby-lang
mistym has quit [Remote host closed the connection]
th2389____ has joined #ruby-lang
dlackty__ has joined #ruby-lang
shennyg__ has joined #ruby-lang
jamo_ has joined #ruby-lang
Mellett68_ has joined #ruby-lang
kalleth_ has joined #ruby-lang
DefV has joined #ruby-lang
Benny1993 has joined #ruby-lang
saltsa_ has joined #ruby-lang
akahn_ has joined #ruby-lang
ozzloy has joined #ruby-lang
jlpeters_ has joined #ruby-lang
ozzloy has joined #ruby-lang
Muz_ has joined #ruby-lang
Kuukunen- has joined #ruby-lang
EvilJStoker_ has joined #ruby-lang
bryanl_ has joined #ruby-lang
GarethAdams_ has joined #ruby-lang
perryh has joined #ruby-lang
imajes_ has joined #ruby-lang
chouhoul_ has joined #ruby-lang
zenspider_ has joined #ruby-lang
banister has joined #ruby-lang
zeusmns_ has joined #ruby-lang
hellome has quit [Write error: Connection reset by peer]
soraher__ has joined #ruby-lang
manveru_ is now known as manveru
perryh is now known as perry
canton7 has joined #ruby-lang
valeri_uF0 is now known as valeri_ufo
anekos_ has joined #ruby-lang
wnd has joined #ruby-lang
lele has joined #ruby-lang
banister has joined #ruby-lang
paulog__ has joined #ruby-lang
banister has quit [Max SendQ exceeded]
kalzz has joined #ruby-lang
lacrosse has joined #ruby-lang
GitNick has joined #ruby-lang
Guest85414______ has joined #ruby-lang
shtirlic has joined #ruby-lang
banister has joined #ruby-lang
JoL1hAHN has joined #ruby-lang
oddmunds has joined #ruby-lang
znz_jp has joined #ruby-lang
banister has quit [Max SendQ exceeded]
jevs has joined #ruby-lang
EvilJStoker_ is now known as EvilJStoker
mattyohe has joined #ruby-lang
hplar has joined #ruby-lang
lsegal has joined #ruby-lang
cmckee has quit [Write error: Connection reset by peer]
phrozen77 has joined #ruby-lang
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
clamstar has joined #ruby-lang
adambeynon has joined #ruby-lang
lguardiola has joined #ruby-lang
banister has joined #ruby-lang
bryanl_ is now known as bryanl
banister has quit [Max SendQ exceeded]
skarn has joined #ruby-lang
skarn is now known as Guest10538
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
FiXato has joined #ruby-lang
pabloh has quit [Ping timeout: 276 seconds]
jlpeters_ is now known as jlpeters
yfeldblum has joined #ruby-lang
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
Kabaka has joined #ruby-lang
banister has joined #ruby-lang
joevandyk has joined #ruby-lang
akahn_ is now known as akahn
banister has quit [Max SendQ exceeded]
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
whitequark has joined #ruby-lang
pabloh has joined #ruby-lang
banister has joined #ruby-lang
banister has quit [Max SendQ exceeded]
kirin` has quit [Ping timeout: 250 seconds]
banister_ has joined #ruby-lang
banister_ has quit [Max SendQ exceeded]
kirin` has joined #ruby-lang
banister_ has joined #ruby-lang
banister_ has quit [Max SendQ exceeded]
centrx has joined #ruby-lang
ggherdov has joined #ruby-lang
banister_ has joined #ruby-lang
banister_ has quit [Max SendQ exceeded]
yfeldblum has quit [Ping timeout: 255 seconds]
banister_ has joined #ruby-lang
banister_ has quit [Max SendQ exceeded]
banister_ has joined #ruby-lang
banister_ has quit [Max SendQ exceeded]
banister_ has joined #ruby-lang
banister_ has quit [Max SendQ exceeded]
symm- has joined #ruby-lang
banister_ has joined #ruby-lang
banister_ has quit [Max SendQ exceeded]
io_syl has quit []
amerine has joined #ruby-lang
mistym has joined #ruby-lang
kirin` has quit [Read error: Connection reset by peer]
zeusmns_ is now known as zeusmns
kirin` has joined #ruby-lang
sharpmachine has joined #ruby-lang
Lewix has quit [Remote host closed the connection]
Lewix has joined #ruby-lang
jbardin has joined #ruby-lang
<sarkyniin>
anyone knows if making custom functions with the sequel gem is possible?
kirin` has quit [Read error: Connection reset by peer]
kirin` has joined #ruby-lang
mikecmpbll has quit [Ping timeout: 260 seconds]
benlovell has quit [Ping timeout: 240 seconds]
diegoviola has quit [Ping timeout: 246 seconds]
yatish27_ has quit [Ping timeout: 240 seconds]
yatish27 has joined #ruby-lang
kirin` has quit [Ping timeout: 255 seconds]
mikecmpbll has joined #ruby-lang
wallerdev has quit [Quit: wallerdev]
kirin` has joined #ruby-lang
karamazov has quit []
djbkd has joined #ruby-lang
kirin` has quit [Ping timeout: 246 seconds]
kirin` has joined #ruby-lang
amsi has joined #ruby-lang
saarinen has joined #ruby-lang
kirin` has quit [Ping timeout: 268 seconds]
hahuang65 has quit [Ping timeout: 268 seconds]
kirin` has joined #ruby-lang
RobertBirnie has joined #ruby-lang
momomomomo_ has joined #ruby-lang
<centrx>
sarkyniin, You can extend any class/module in the gem
shinnya has quit [Ping timeout: 255 seconds]
momomomomo has quit [Ping timeout: 252 seconds]
momomomomo_ is now known as momomomomo
mkaesz has joined #ruby-lang
<darix>
yorickpeterse: our ruby library packaging is doing the gem way
ender|dkm has joined #ruby-lang
hellangel7 has joined #ruby-lang
kirin` has quit [Read error: Connection reset by peer]
ruby-lang175 has quit [Quit: Page closed]
kirin` has joined #ruby-lang
yfeldblum has joined #ruby-lang
wallerdev has joined #ruby-lang
kirin` has quit [Ping timeout: 245 seconds]
<spastorino>
workmad3: saw your mention a bit late, no worries :)
skade has quit [Quit: Computer has gone to sleep.]
yfeldblum has quit [Ping timeout: 252 seconds]
palar has joined #ruby-lang
io_syl has joined #ruby-lang
kirin` has joined #ruby-lang
parenjitsu has joined #ruby-lang
kirin` has quit [Read error: Connection reset by peer]
kirin` has joined #ruby-lang
enkristoffer has joined #ruby-lang
yibeikafei has joined #ruby-lang
allomov has quit [Remote host closed the connection]
havenwood has quit [Remote host closed the connection]
workmad3 has quit [Ping timeout: 240 seconds]
havenwood has joined #ruby-lang
Reen has quit [Ping timeout: 250 seconds]
nertzy has joined #ruby-lang
seamon has joined #ruby-lang
michaeldeol has joined #ruby-lang
arBmind has quit [Quit: Leaving.]
pabloh has quit [Ping timeout: 260 seconds]
xtruder has joined #ruby-lang
pabloh has joined #ruby-lang
<xtruder>
hi
<xtruder>
could anyone help me with rss parser?
hahuang65 has joined #ruby-lang
<Phrogz>
xtruder: Please don't ask if you can ask (or if someone is awake, or can help you). Just boldly ask your question and wait for help. :)
<Phrogz>
It's not a dinner party or a Lorde song; you do not have to wait until you're announced.
<xtruder>
lol ok
<xtruder>
i have this basic parser: http://pastebin.com/1K2p33Gz, id like to set a limit to number of feeds to retrieve
skade has joined #ruby-lang
mahlon has quit [Quit: nine foot long outhouse ladle]
kgrz has quit [Remote host closed the connection]
kgrz has joined #ruby-lang
<Phrogz>
xtruder: You mean that you want the first n items?
<xtruder>
yes
loincloth has quit [Remote host closed the connection]
kgrz has quit [Remote host closed the connection]
nertzy has quit [Quit: This computer has gone to sleep]
kgrz has joined #ruby-lang
kgrz has quit [Remote host closed the connection]
marr has quit [Ping timeout: 268 seconds]
omosoj has joined #ruby-lang
momomomomo has quit [Quit: momomomomo]
tbuehlmann has quit [Remote host closed the connection]
<havenwood>
xtruder: rss.items.first(n).each do |item|
<havenwood>
xtruder: or take(n)
michaeldeol has quit [Read error: Connection reset by peer]
ender|dkm has quit [Ping timeout: 264 seconds]
bsvineeth has quit [Remote host closed the connection]
<|jemc|>
looks like the conversation got bogged down in looking at other memoization patterns instead of realizing that was just one example use case for a thunk_method
<headius>
it kinda got bogged down in discussions about general-purpose memoization
<|jemc|>
heh
<|jemc|>
yep
<headius>
I just wanted something that was a method pointing at a value with no method overhead
<|jemc|>
yep - with memoization as just one use case
<|jemc|>
looks like rubinius has it
<|jemc|>
as one of the "extra" methods provided beyond the MRI methods
seamon has joined #ruby-lang
<headius>
I think Evan added it back when we were having the discussion
<headius>
what is it called in Rubinius?
<headius>
it's obviously a trivial thing to add to any impl, so it's mostly just about justifying its existence
<|jemc|>
Module#thunk_method - just as you suggested
<|jemc|>
I was trying to figure out what it was doing and found your proposal in the process :)
<headius>
ahh cool
<headius>
probably could do it as a gem that basically uses attr_reader and a hidden class-level instance var, or something
x0f has quit [Ping timeout: 240 seconds]
palar_ has quit []
x0f has joined #ruby-lang
pabloh has quit [Ping timeout: 260 seconds]
<headius>
|jemc|: feel free to bump the issue and see if there's interest now
xsdg has quit [Quit: leaving]
<|jemc|>
heh. I think I've already lost my faith in community involvement in the ruby-lang design process :P
<|jemc|>
out of curiosity - is jruby (like rubinius) also in the habit of providing extra exposed methods like that?
Lewix has joined #ruby-lang
yfeldblum has joined #ruby-lang
ianmcshane has joined #ruby-lang
<headius>
ruby-lang process works fine...but it requires a lot of participation
<headius>
and no, we generally try to avoid exposing jruby-specific stuff unless absolutely necessary
bsvineeth has joined #ruby-lang
<headius>
the Java integration subsystem, for example
[spoiler] has joined #ruby-lang
<headius>
we will occasionally throw nonstandard features in when discussing them in a feature request, so there's a way for people to play with it
bsvineeth has quit [Remote host closed the connection]
migbar_ has quit [Remote host closed the connection]
migbar has joined #ruby-lang
yatish27 has quit [Remote host closed the connection]
momomomomo has joined #ruby-lang
yatish27 has joined #ruby-lang
jgpawletko is now known as jgpawletko_away
yatish27 has quit [Ping timeout: 255 seconds]
cmhobbs has quit [Quit: Leaving]
wallerdev has quit [Quit: wallerdev]
<bougyman>
how can I get a string that contains a non-utf character?
migbar has quit [Ping timeout: 255 seconds]
<manveru>
bougyman: "\udfff"
kgrz has joined #ruby-lang
ianmcshane has quit [Remote host closed the connection]
ianmcshane has joined #ruby-lang
<headius>
non-UTF would be with \x
<bougyman>
trying to get something to throw an error about non-UTF8
<bougyman>
i've tried a bunch of \x stuff
ender|dkm has joined #ruby-lang
momomomomo has quit [Quit: momomomomo]
arBmind has joined #ruby-lang
kgrz has quit [Ping timeout: 276 seconds]
skade has quit [Quit: Computer has gone to sleep.]
<headius>
Ruby will turn literal strings with non-US-ASCII bytes in them into ASCII-8BIT, so you might not get the error without force_encoding
ender|dkm has quit [Ping timeout: 264 seconds]
chouhoul_ has quit [Ping timeout: 260 seconds]
pabloh has joined #ruby-lang
chouhoulis has joined #ruby-lang
Mon_Ouie has quit [Ping timeout: 272 seconds]
yatish27 has joined #ruby-lang
bsvineeth has joined #ruby-lang
bsvineeth has quit [Remote host closed the connection]
marr has joined #ruby-lang
yatish27_ has joined #ruby-lang
marr has quit [Read error: Connection reset by peer]
<yorickpeterse>
matti: so youtube lost track of my watch history (guess 3k is too much) and of course I didn't bookmark stuff. I'm now literally using this to find my music back: find . -name '*ruby-lang*' | xargs grep -P 'yorickpeterse.+matti.+youtube'
<yorickpeterse>
matti: so I guess IRC logs are now my bookmarks
yatish2__ has joined #ruby-lang
marr has joined #ruby-lang
yatish27 has quit [Ping timeout: 240 seconds]
michaeldeol has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
yatish27_ has quit [Ping timeout: 240 seconds]
michaeldeol has joined #ruby-lang
havenwood has quit [Remote host closed the connection]
michaeldeol has quit [Client Quit]
havenwood has joined #ruby-lang
djbkd has quit [Remote host closed the connection]
kwd_ has quit [Quit: Sleeping now. ZZZzzz…]
havenwood has quit [Ping timeout: 264 seconds]
imkmf has joined #ruby-lang
benlovell has joined #ruby-lang
nertzy has joined #ruby-lang
amsi has quit [Ping timeout: 252 seconds]
enkristoffer has quit [Quit: ❤]
chouhoulis has quit [Remote host closed the connection]
nertzy has quit [Quit: This computer has gone to sleep]
ayonkhan has joined #ruby-lang
jbardin has quit [Quit: jbardin]
pabloh has quit [Quit: Saliendo]
chouhoulis has joined #ruby-lang
chouhoulis has quit [Remote host closed the connection]
nertzy has joined #ruby-lang
chouhoulis has joined #ruby-lang
solars has joined #ruby-lang
emmesswhy has quit [Quit: This computer has gone to sleep]
<matti>
yorickpeterse: Haha
<matti>
yorickpeterse: Nice detective work
yatish2__ has quit [Ping timeout: 268 seconds]
michaeldeol has joined #ruby-lang
hellangel7 has quit [Read error: Connection reset by peer]
necro has quit [Ping timeout: 246 seconds]
migbar has joined #ruby-lang
skade has joined #ruby-lang
ianmcshane has quit [Read error: Connection reset by peer]
katmutua has joined #ruby-lang
nertzy has quit [Quit: This computer has gone to sleep]
jbardin has joined #ruby-lang
jkprg has joined #ruby-lang
loincloth has quit [Remote host closed the connection]
djbkd has joined #ruby-lang
kgrz has joined #ruby-lang
migbar has quit [Ping timeout: 240 seconds]
jkprg has quit [Remote host closed the connection]
jkprg has joined #ruby-lang
jgpawletko_away is now known as jgpawletko
djbkd has quit [Remote host closed the connection]
djbkd has joined #ruby-lang
wallerdev has joined #ruby-lang
momomomomo has joined #ruby-lang
kgrz has quit [Ping timeout: 260 seconds]
toastynerd has quit [Remote host closed the connection]
yatish27 has joined #ruby-lang
seamon has quit [Quit: Zzzzzzz]
ianmcshane has joined #ruby-lang
ender|dkm has joined #ruby-lang
jkprg has quit [Quit: jkprg]
rcvalle has joined #ruby-lang
relix_ has joined #ruby-lang
emmesswhy has joined #ruby-lang
relix has quit [Ping timeout: 245 seconds]
toastynerd has joined #ruby-lang
postmodern has joined #ruby-lang
ianmcshane has quit [Remote host closed the connection]
nertzy has joined #ruby-lang
ianmcshane has joined #ruby-lang
momomomomo_ has joined #ruby-lang
benlovell has quit [Ping timeout: 268 seconds]
momomomomo has quit [Ping timeout: 245 seconds]
momomomomo_ is now known as momomomomo
djbkd has quit [Read error: Connection reset by peer]
ianmcshane has quit [Remote host closed the connection]
djbkd has joined #ruby-lang
ianmcshane has joined #ruby-lang
ianmcshane has quit [Remote host closed the connection]
ianmcshane has joined #ruby-lang
loincloth has joined #ruby-lang
_Kerber0s_ has joined #ruby-lang
ianmcshane has quit [Remote host closed the connection]
Kerber0s has quit [Ping timeout: 268 seconds]
ianmcshane has joined #ruby-lang
eddiezane_zzz is now known as eddiezane
toastynerd has quit [Remote host closed the connection]
gix has quit [Quit: Client exiting]
nertzy has quit [Quit: This computer has gone to sleep]
gix has joined #ruby-lang
toastynerd has joined #ruby-lang
heftig_ is now known as heftig
ianmcshane has quit [Remote host closed the connection]
ianmcshane has joined #ruby-lang
ianmcshane has quit [Read error: Connection reset by peer]
findchris has joined #ruby-lang
Muz_ is now known as Muz
mkaesz has quit [Remote host closed the connection]
amsi has joined #ruby-lang
toastynerd has quit [Remote host closed the connection]
katmutua has left #ruby-lang [#ruby-lang]
symm- has quit [Ping timeout: 240 seconds]
toastynerd has joined #ruby-lang
sharpmachine has quit [Remote host closed the connection]
relix_ has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<hahuang65>
basically I just go through the word, slice off the first and last letter, take the ordinate difference, absolute value it, and add it to steps.
ender|dkm has quit [Ping timeout: 264 seconds]
<hahuang65>
cleanest way I could think of.
<wallerdev>
id probably do that loop in 2 steps if you were concerned about clean lol
<wallerdev>
not a fan of ! methods
emmesswhy has joined #ruby-lang
<hahuang65>
wallerdev: why is taht
<wallerdev>
because they modify things
<wallerdev>
like if you had x = "hello world" and you passed it into your method that does this
<wallerdev>
x has now changed
<wallerdev>
which is usually unexpected
<hahuang65>
wallerdev: that's the whole point of the loop right, so that I can keep slicing pieces off since the condition of the loop is based on the string
<hahuang65>
wallerdev: I understand what you mean
<hahuang65>
wallerdev: what were you suggesting in 2 parts?
<wallerdev>
like tc[-1].ord - tc[0].ord; then next like tc = tc[1..-2] or something
<hahuang65>
wallerdev: yeah but the tradeoff there is readability no?
<wallerdev>
i think its more readable as two lines lol
<hahuang65>
wallerdev: adding more indexes to code is hella confusing for me as someone coming in who hasn't thought about the code yet
<hahuang65>
I would have no idea what [1..-2] meant in this context
<wallerdev>
and whenever i see ! i have to think about things more, like is it modifying something thats used in other places, does it matter that it is being modified twice in that line, does it matter which part of the subtraction runs first
<hahuang65>
where as slice(0) and slice(-1) means I'm taking the first and last letters always
<wallerdev>
stuff like that
<hahuang65>
right but when it's as isolated as this code, i'd prefer NOT to use additional indexes
<hahuang65>
wallerdev: I'
nofxx__ has joined #ruby-lang
<wallerdev>
haha go for it, doesnt matter much for a coding challenge
<hahuang65>
never use ! in our production code ;)
<hahuang65>
wallerdev: I've run into the exact thing you're talking about in our prod code. Immutability is very helpful in those cases.
<wallerdev>
yeah i like how languages like C# make strings immutable
<hahuang65>
wallerdev: been working with Scala and Elixir. It makes somethings much harder, but it's also nice because of the safety.
charliesome has quit [Quit: zzz]
imkmf has quit [Ping timeout: 264 seconds]
MichD is now known as michd
allomov has quit [Remote host closed the connection]
charliesome has joined #ruby-lang
seamon has joined #ruby-lang
workmad3 has quit [Ping timeout: 246 seconds]
sharpmachine has joined #ruby-lang
CorrosiveOne has joined #ruby-lang
CorrosiveOne is now known as CorEnc55
CorEnc55 has left #ruby-lang [#ruby-lang]
necro has joined #ruby-lang
<necro>
I am trying to install "Rspec" as I am doing a ruby tutorial and am getting this error message : you don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory. -- How do I access this directory, how do I change it's permissions?
<wallerdev>
sudo gem install rspec
<wallerdev>
probably
imkmf has joined #ruby-lang
tectonic has joined #ruby-lang
tectonic has quit [Max SendQ exceeded]
vintik has joined #ruby-lang
migbar has quit [Remote host closed the connection]
<necro>
sorry wallerdev I
migbar has joined #ruby-lang
<necro>
m not sure what you mean, new to this
imkmf_ has joined #ruby-lang
<|jemc|>
necro: your gems are installed in a directory that requires root permissions to write to
imkmf has quit [Read error: Connection reset by peer]
<|jemc|>
necro: sudo is a terminal command that allows you to execute the following command with escalated permissions
<necro>
oh thank you so much!
<necro>
I really appreciate that. I got another sugegstion that solved the issue...much appreciated
loincloth has quit [Remote host closed the connection]
<hahuang65>
necro: but if you're just learning it might be better to look at it later, since it might just pile on more stuff to learn.
<necro>
is system ruby the default ruby on my comp?
jamo_ is now known as Jamo
<necro>
oh actually I did install rvm
<necro>
the other day, as someone recommended I do...
<necro>
Ok I downloaded rspec but this warning appeared: WARNING: You don't have /Users/dianatourjee/.gem/ruby/2.0.0/bin in your PATH, gem executables will not run.
<necro>
alright I put that in but nothing happened
<necro>
same error is popping up for rspec
<postmodern>
there is nothing wrong with system ruby
<necro>
ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
<hahuang65>
havenwood: hey, nice. That works well.
<necro>
i also tried"gem install --user-install rspec" which downlaoded some gems but also retuned this error: WARNING: You don't have /Users/bbb/.gem/ruby/2.0.0/bin in your PATH, gem executables will not run.
<jhass>
why don't you just add the mentioned directory to your PATH?
<hahuang65>
postmodern: nothign wrong with system ruby. Agree. Just an organizational preference.
<necro>
I'm not sure how to do that
ender|dkm has joined #ruby-lang
<jhass>
google
<hahuang65>
necro: what tutorial are you using?
<hahuang65>
necro: might I suggest Michael Hartl's tutorial? Walks you through everything, including installing Ruby and getting gems and tests set up.
<necro>
I will look now - I just added the directory to the path but then it said it's not a directory so I can't
<jhass>
what exactly did you do
<jhass>
what command did you run
<jhass>
be descriptive and exact
<necro>
sudo nano /etc/paths
<necro>
prompted me for password
<necro>
then I added the file at the bottom of the page, as I read to do on google, and it responded that it was unable as /Users/bbb/.gem/ruby/2.0.0/bin was not a directory
sharpmachine has quit [Remote host closed the connection]
workmad3 has joined #ruby-lang
imkmf has joined #ruby-lang
Lewix has quit [Read error: Connection reset by peer]
sharpmachine has joined #ruby-lang
Lewix has joined #ruby-lang
nertzy has quit [Ping timeout: 255 seconds]
earthquake has quit [Quit: earthquake]
nertzy has joined #ruby-lang
<hahuang65>
necro: that's not what you want to do
<necro>
...oh
nertzy has quit [Ping timeout: 255 seconds]
<necro>
well thank you all for oyur help, I have to go now - I appreciate it very much.
amerine has quit [Ping timeout: 276 seconds]
amerine_ has joined #ruby-lang
necro has quit [Ping timeout: 246 seconds]
earthquake has joined #ruby-lang
yatish27 has joined #ruby-lang
sharpmachine has quit [Remote host closed the connection]
sharpmachine has joined #ruby-lang
seamon has quit [Quit: Zzzzzzz]
seamon has joined #ruby-lang
Guest10538 has quit [Changing host]
Guest10538 has joined #ruby-lang
vintik has quit [Remote host closed the connection]
Lewix has quit [Read error: Connection reset by peer]
Guest10538 is now known as skarn
Lewix has joined #ruby-lang
Sgeo has joined #ruby-lang
imkmf_ has joined #ruby-lang
vintik has joined #ruby-lang
charliesome has joined #ruby-lang
mikecmpbll has quit [Quit: i've nodded off.]
toastynerd has joined #ruby-lang
imkmf has quit [Ping timeout: 246 seconds]
djbkd has quit [Remote host closed the connection]
benlovell has joined #ruby-lang
imkmf_ is now known as imkmf
djbkd has joined #ruby-lang
skade has quit [Read error: Connection reset by peer]
skade_ has joined #ruby-lang
benlovell has quit [Ping timeout: 252 seconds]
jdecuirm has joined #ruby-lang
<jdecuirm>
Hi all! good afternoon
<jdecuirm>
I need someone to explain a fragment of the book beginning ruby, maybe i'm not getting it right!
<jdecuirm>
i will appreciate it a lot!
elico has joined #ruby-lang
<jdecuirm>
I am working with blocks, and the fragment is "Many elements of syntax are not objects, nor are code blocks in their literal form.)
Kerber0s has joined #ruby-lang
jdecuirm has quit [Client Quit]
<havenwood>
jdecuirm: syntax like `if` and `=` aren't Objects, e.g., you can't ask them: if.is_a?(Object)