xall has quit [Read error: Connection reset by peer]
awakenedlink has joined #ruby
paradisaeidae has joined #ruby
jaguarmagenta has quit [Ping timeout: 244 seconds]
sp4rrow has quit [Quit: The Internet needs a break and I need a cookie]
sp4rrow has joined #ruby
dunpeal has quit [Ping timeout: 276 seconds]
awakenedlink has quit []
jrafanie has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
chipotle has joined #ruby
k3rn31 has quit [Quit: Computer has gone to sleep.]
RegulationD has joined #ruby
dvinciguerra_ has quit [Ping timeout: 244 seconds]
Rickmasta has joined #ruby
nankyokusei has joined #ruby
vdamewood has quit [Quit: Life beckons.]
SilverKey has quit [Quit: Halted.]
rubynoob has joined #ruby
djdarkbeat has joined #ruby
RegulationD has quit [Ping timeout: 276 seconds]
sp4rrow_ has joined #ruby
<rubynoob>
hey guys, i have a noob question regarding hash literals. I see where people are specifying hashes using KEY: 'VALUE' and see others specifying 'KEY' => 'VALUE'. Is one more correct than another
<rubynoob>
?
giz|work|2 has joined #ruby
nankyokusei has quit [Ping timeout: 244 seconds]
killerkamel has quit [Ping timeout: 258 seconds]
giz|work has quit [Ping timeout: 252 seconds]
sp4rrow has quit [Ping timeout: 240 seconds]
SilverKey has joined #ruby
ur5us has joined #ruby
ur5us_ has joined #ruby
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
killerkamel has joined #ruby
<rubynoob>
hey guys, i have a noob question regarding hash literals. I see where people are specifying hashes using KEY: 'VALUE' and see others specifying 'KEY' => 'VALUE'. Is one more correct than another ?
sdothum has quit [Quit: ZNC - 1.6.0 - http://znc.in]
ta_ has joined #ruby
ur5us_ has quit [Ping timeout: 265 seconds]
Rickmasta has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
pawnbox_ has quit [Remote host closed the connection]
killerkamel has quit [Ping timeout: 240 seconds]
blackmesa has joined #ruby
pawnbox has joined #ruby
ramfjord has quit [Ping timeout: 265 seconds]
LoneHerm_ has joined #ruby
Jackneill has joined #ruby
duoi has quit [Ping timeout: 250 seconds]
roamingdog has quit [Remote host closed the connection]
Tyrese has quit [Ping timeout: 250 seconds]
duoi has joined #ruby
yoongkan_ has joined #ruby
LoneHerm_ has quit [Ping timeout: 244 seconds]
DoubleMalt has joined #ruby
skade has quit [Read error: Connection reset by peer]
AlexRussia has joined #ruby
skade has joined #ruby
yoongkan_ has quit [Ping timeout: 276 seconds]
Pupeno has quit [Remote host closed the connection]
pandaant has quit [Remote host closed the connection]
bkxd has quit [Ping timeout: 260 seconds]
matp has joined #ruby
Guest51233 has quit [Ping timeout: 276 seconds]
bkxd has joined #ruby
yoongkan_ has joined #ruby
hanmac has quit [Ping timeout: 258 seconds]
bkxd has quit [Ping timeout: 240 seconds]
Alina-malina has quit [Ping timeout: 258 seconds]
bkxd has joined #ruby
Guest51233 has joined #ruby
singalaut has quit [Read error: Connection reset by peer]
Pupeno has joined #ruby
miqlas-H has quit [Quit: Vision[0.9.7-H-20140108]: i've been blurred!]
spyder55 has quit []
hanmac has joined #ruby
pwnd_nsfw has quit [Ping timeout: 258 seconds]
Pupeno has quit [Remote host closed the connection]
instinkt has joined #ruby
Jackneill has quit [Quit: Leaving]
instinkt has quit [Client Quit]
narcan has joined #ruby
narcan has quit [Excess Flood]
narcan has joined #ruby
narcan has quit [Excess Flood]
the_drow has quit [Quit: This computer has gone to sleep]
[narcan] has joined #ruby
RegulationD has joined #ruby
nankyokusei has joined #ruby
dunpeal has joined #ruby
RegulationD has quit [Ping timeout: 244 seconds]
nankyokusei has quit [Ping timeout: 258 seconds]
the_drow has joined #ruby
KaliLinuxGR has joined #ruby
craigp_ has joined #ruby
DoubleMalt has quit [Ping timeout: 244 seconds]
JeanCarloMachado has joined #ruby
roamingdog has joined #ruby
DoubleMalt has joined #ruby
Moosashi has joined #ruby
sleepee has quit [Ping timeout: 244 seconds]
sleepee has joined #ruby
roamingdog has quit [Ping timeout: 276 seconds]
Moosashi has quit [Client Quit]
Moosashi has joined #ruby
hahuang61 has joined #ruby
conta1 has joined #ruby
conta has quit [Ping timeout: 244 seconds]
conta1 is now known as conta
ishahnaz has joined #ruby
CybrGhost has left #ruby ["Leaving"]
jxs_ has joined #ruby
hahuang61 has quit [Ping timeout: 250 seconds]
bathtub_shark has quit [Remote host closed the connection]
Ishido has quit [Remote host closed the connection]
bathtub_shark has joined #ruby
Moosashi has quit [Quit: Moosashi]
flak has joined #ruby
Ishido has joined #ruby
sukra has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jaguarmagenta has joined #ruby
mattwashere has joined #ruby
the_drow has quit [Quit: This computer has gone to sleep]
rippa has quit [Ping timeout: 249 seconds]
ramfjord has joined #ruby
bkxd has quit [Ping timeout: 276 seconds]
blackmesa has quit [Ping timeout: 264 seconds]
jaguarmagenta has quit [Ping timeout: 244 seconds]
al2o3-cr has quit [Quit: WeeChat 1.5]
Vingador has joined #ruby
skade has quit [Quit: Computer has gone to sleep.]
framling has quit [Ping timeout: 264 seconds]
Vingador_ has joined #ruby
ramfjord has quit [Ping timeout: 244 seconds]
Vingador has quit [Ping timeout: 244 seconds]
the_drow has joined #ruby
mattwashere has quit [Remote host closed the connection]
conta has quit [Read error: Connection reset by peer]
KaliLinuxGR has quit [Quit: Αποχώρησε]
mattwashere has joined #ruby
conta has joined #ruby
giz|work|2 has joined #ruby
Vingador_ has quit [Remote host closed the connection]
giz|work has quit [Ping timeout: 244 seconds]
LoneHerm_ has joined #ruby
chipotle has joined #ruby
chipotle has quit [Client Quit]
Ishido has quit [Remote host closed the connection]
killerkamel has joined #ruby
SCHAAP137 has quit [Quit: Exiting...]
zeroDi has joined #ruby
thomas_25 has joined #ruby
<thomas_25>
I'm trying jruby via rvm but it seems vastly slower to start (say, jekyll). Is that normal?
Ishido has joined #ruby
<thomas_25>
I'm forking a ruby program from by user API and it is the last bottleneck in my chain, so I'm looking for some easy optimizations
LoneHerm_ has quit [Ping timeout: 258 seconds]
<thomas_25>
total toolchain was taking 2 minutes, now I've shaved it to 10 seconds and 7 seconds of that is running a ruby program :/
Pupeno has joined #ruby
minimalism has quit [Quit: minimalism]
killerkamel has quit [Ping timeout: 276 seconds]
Jackneill has joined #ruby
MrBusiness2 has quit [Quit: Leaving]
Pupeno has quit [Ping timeout: 240 seconds]
MrBusiness has joined #ruby
AndyBotwin has quit [Quit: Leaving]
<jhass>
well, jruby boots the JVM
<jhass>
that's just kinda slow
the_drow has quit [Quit: This computer has gone to sleep]
roamingdog has joined #ruby
Pupeno has joined #ruby
<thomas_25>
there could be a option to keep it idle
ajith has joined #ruby
killerkamel has joined #ruby
roamingdog has quit [Ping timeout: 258 seconds]
nando293921 has joined #ruby
<thomas_25>
heh, thanks to rvm, it's easy to try implementations, i've tried rubinius, which proved to be wildly slower than official ruby implementation.
douglascorrea has joined #ruby
flak has quit [Ping timeout: 276 seconds]
killerkamel has quit [Ping timeout: 258 seconds]
Madplatypus has quit [Quit: Connection closed for inactivity]
douglascorrea has quit [Ping timeout: 240 seconds]
Wildfyr has quit [Ping timeout: 252 seconds]
Wildfyr has joined #ruby
ur5us has joined #ruby
Pupeno has quit [Remote host closed the connection]
bkxd has joined #ruby
the_drow has joined #ruby
ChameleonSix has joined #ruby
ChameleonSix has left #ruby [#ruby]
blackmesa has joined #ruby
pwnd_nsfw has joined #ruby
mattwashere has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 265 seconds]
bkxd has quit [Ping timeout: 240 seconds]
JeanCarl1Machado has joined #ruby
mattwashere has joined #ruby
SCHAAP137 has joined #ruby
the_drow has quit [Quit: This computer has gone to sleep]
blackmesa has quit [Ping timeout: 244 seconds]
JeanCarloMachado has quit [Ping timeout: 244 seconds]
BaroMeter has joined #ruby
ledestin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
oscardaichi has joined #ruby
vuoto has quit [Remote host closed the connection]
vuoto has joined #ruby
yardenbar has quit [Ping timeout: 258 seconds]
mattwashere has quit []
the_drow has joined #ruby
the_drow has quit [Remote host closed the connection]
ajith has quit [Quit: Leaving]
openstruct has joined #ruby
ramfjord has joined #ruby
Alina-malina has joined #ruby
Alina-malina has quit [Changing host]
Alina-malina has joined #ruby
openstruct has quit [Ping timeout: 252 seconds]
ramfjord has quit [Ping timeout: 244 seconds]
ElFerna has joined #ruby
fanantoxa has joined #ruby
edwardly has quit [Ping timeout: 276 seconds]
kus has joined #ruby
kus has quit [Max SendQ exceeded]
the_drow has joined #ruby
edwardly has joined #ruby
edwardly has quit [Changing host]
edwardly has joined #ruby
RegulationD has joined #ruby
AndrewIsHere has joined #ruby
nankyokusei has joined #ruby
conta has quit [Ping timeout: 258 seconds]
Pupeno has joined #ruby
RegulationD has quit [Ping timeout: 240 seconds]
AndrewIsHere has quit [Ping timeout: 250 seconds]
nankyokusei has quit [Ping timeout: 260 seconds]
the_drow has quit [Quit: This computer has gone to sleep]
Pupeno has quit [Remote host closed the connection]
rippa has joined #ruby
BaroMeter has quit [Quit: Leaving]
blackmesa has joined #ruby
jenrzzz has quit [Read error: Connection reset by peer]
roamingdog has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jenrzzz has joined #ruby
saneax_AFK is now known as saneax
jishankai has quit [Ping timeout: 240 seconds]
evie_hammond has joined #ruby
roamingdog has quit [Ping timeout: 250 seconds]
banisterfiend has joined #ruby
alfiemax has joined #ruby
al2o3-cr has joined #ruby
Rodya_ has joined #ruby
hahuang61 has joined #ruby
ubuntu has joined #ruby
Pupeno has joined #ruby
ubuntu is now known as Guest68437
banisterfiend has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
AlexRussia has quit [Ping timeout: 244 seconds]
davedev2_ has joined #ruby
Pupeno has quit [Remote host closed the connection]
hahuang61 has quit [Ping timeout: 250 seconds]
davedev24 has quit [Ping timeout: 250 seconds]
banisterfiend has joined #ruby
johnmilton has joined #ruby
chouhoulis has joined #ruby
jaguarmagenta has joined #ruby
banisterfiend has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
chouhoulis has quit [Ping timeout: 250 seconds]
jaguarmagenta has quit [Ping timeout: 244 seconds]
kouradas has joined #ruby
the_drow has joined #ruby
pawnbox has quit [Remote host closed the connection]
LoneHerm_ has joined #ruby
banisterfiend has joined #ruby
AlexRussia has joined #ruby
craigp_ has quit [Ping timeout: 260 seconds]
sepp2k has quit [Read error: Connection reset by peer]
JeanCarl1Machado has quit [Ping timeout: 240 seconds]
LoneHerm_ has quit [Ping timeout: 250 seconds]
marr has quit [Ping timeout: 276 seconds]
blackmesa has quit [Ping timeout: 258 seconds]
oscardaichi has quit [Quit: Leaving]
hwcomcn has quit [Ping timeout: 265 seconds]
AlexRussia has quit [Ping timeout: 260 seconds]
RegulationD has joined #ruby
adl has joined #ruby
bkxd has joined #ruby
RegulationD has quit [Ping timeout: 276 seconds]
bkxd has quit [Ping timeout: 240 seconds]
Guest51233 has quit [Ping timeout: 260 seconds]
giz|work has joined #ruby
giz|work|2 has quit [Ping timeout: 244 seconds]
chouhoulis has joined #ruby
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby
conta has joined #ruby
adl has quit [Ping timeout: 265 seconds]
Guest51233 has joined #ruby
phrozen77 has joined #ruby
killerkamel has joined #ruby
sleepee has quit [Quit: Leaving]
seap has joined #ruby
vuoto has quit [Remote host closed the connection]
killerkamel has quit [Ping timeout: 244 seconds]
vuoto has joined #ruby
pawnbox has joined #ruby
theery has quit [Ping timeout: 276 seconds]
RubyNewby123 has joined #ruby
[narcan] has quit [Quit: -[AppDelegate installMalware]: unrecognized selector sent to instance 0x156109c0]
<RubyNewby123>
Hi guys, I'm a total ruby noob, struggling with a super basic issue with blocks, would someone being able to help?
banisterfiend has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
apipkin_ has quit [Ping timeout: 250 seconds]
<RubyNewby123>
Writing a tragically simple text adventure to try and learn but this block thing has me stumped. I can follow tuts which work but when I make a slight deviation to add to my code it falls apart and the error is maddeningly confusing
theery has joined #ruby
<RubyNewby123>
https://repl.it/CfX9/0 < here's my snippet the result is "(repl):76: syntax error, unexpected '}', expecting end-of-input ...ss_drawbridge], {puts "hello!"})" which is exactly what I have
pawnbox has quit [Ping timeout: 260 seconds]
theery has quit [Read error: Connection reset by peer]
<shevy>
there are two major different ways to use a block
<shevy>
the simpler one is to use {} to the method
theery has joined #ruby
rubynewbie has joined #ruby
<shevy>
in your example the faulty line is: start = Choice.new("Start", "You arrive at the castle entrance.", [cross_drawbridge], { puts "hello!"})
apipkin_ has joined #ruby
<shevy>
invoke_method('arg1','arg2') { your block here }
<RubyNewby123>
shevy: thanks, I'd assumed that but how do I correct?
zacstewart has quit [Ping timeout: 244 seconds]
<RubyNewby123>
Ooooh? so the block must come outside of the arguments!?
<shevy>
in your case you don't seem to need any block or?
<RubyNewby123>
oooooh... Coming from c# this is all new to me, I tried that and it runs without error (though doesn't print "hello"), still, this is progress.
<shevy>
if you want to get the content of the block, and if you don't use the &variant, you can check via: yielded_part = yield if block_given?
astrobunny has quit [Ping timeout: 276 seconds]
<RubyNewby123>
well that was just an illustrative example, the idea behind it was to pass in the player object and a block on how that "choice" affect them, so at one point, they search a corpse and find 5 gold coins and so the player object will be appened
<shevy>
blocks are just an extra argument available to every method in ruby but not every method needs to make use of blocks
theery has quit [Client Quit]
yoongkan_ has quit [Remote host closed the connection]
<shevy>
if you already know C# then a lot of the setup of your code will work about 1:1, your class-based design on the sample code is already quite good, definitely not the newbie stage
<RubyNewby123>
ah thanks man... I've been so frustrated with myself for not being able to get this, that really means a lot
bedouin has quit [Ping timeout: 250 seconds]
zacstewart has joined #ruby
astrobunny has joined #ruby
<RubyNewby123>
basically, where I'm instantiating the "choices", I want to pass in some logic that this choice will have, in c# I would pass a lambda delegate
davedev2_ has quit [Read error: Connection reset by peer]
davedev24 has joined #ruby
bedouin has joined #ruby
<RubyNewby123>
I think I had stumbled onto those blog posts you listed before but I will revisit and study them, more confident in their relevance. Thank you so much shevy
davedev2_ has joined #ruby
<shevy>
well the foo() { block } syntax I find very simple
<RubyNewby123>
yes actually i does print the "hello" as expected,
blackmesa has joined #ruby
<shevy>
get '/hi' do
<RubyNewby123>
it does indeed seem simple enough now that you mention it. the whole concept of putting a block AFTER the calling params/args is a foreign one to me but now that I know the convention of putting them outside/after, it should be simple going forward
<RubyNewby123>
may I ask one more question? It's theoretical and I've really struggled to find an answer on google
davedev24 has quit [Ping timeout: 250 seconds]
<shevy>
it is not good to ask whether you can ask. it is better to just ask, someone here can reply
<RubyNewby123>
As I'm passing the block parm, to the constructor of my class, could I then assign is to a instance variable? such as @block = block or @block = &block? ...so that I can use it elshwere in the class
<RubyNewby123>
noted
davedev24 has joined #ruby
nizzlefritz has joined #ruby
<Zarthus>
do you mean getting the result from th e block, or within the block?
<shevy>
you can use variables yes
LoneHerm_ has joined #ruby
<shevy>
it can become a bit complicated
<shevy>
for instance, in one class, I have something like this: class Foo; def initialize; instance_eval(&block) if block_given?; end; end
<RubyNewby123>
so in my example, https://repl.it/CfX9/1, I'm calling it in my consturctor but I want to call it in the body of the class eventually, I've read conflicting things about doing this but would like to assign it to an instance variable
blackmesa has quit [Ping timeout: 265 seconds]
<shevy>
I also did not comment why I did it there so I have no idea why I am doing it :D
<RubyNewby123>
lol
davedev2_ has quit [Ping timeout: 250 seconds]
<shevy>
yes just assign it
<shevy>
in my above example: @foo = yield if block_given?
<shevy>
or in your example when you use the variable.call part, for procs
roamingdog has joined #ruby
LoneHerm_ has quit [Ping timeout: 240 seconds]
<RubyNewby123>
I must admit, I still feel I'm away off "getting" ruby. I still don't see the appeal but I know this is based on ignorance as senior devs at my workplace (black belts to my blue belt) think it's fantastic, despite being primarily c# devs. To me it seems a bit to fast and loose which I intellectually know is the selling point but don't grasp why that's a good thing yet
<Zarthus>
don't worry about it taking some time
<RubyNewby123>
that's fantastic help shevy, thank you so much. You've likely saved me hours of frustration. I owe you a beer my man
<RubyNewby123>
thanks Zarthus
<shevy>
well appeal, you have all the usual way to pass arguments into methods - and on top of it you can also use blocks
<shevy>
but just because a feature is available does not need that you need or need to use it
Rickmasta has joined #ruby
<shevy>
but you already see that you can design very succinct domain specific APIs; rails is a domain-specific language, sinatra is
<shevy>
prawn probably is too
xxninjabunnyxx has joined #ruby
zacstewart has quit [Ping timeout: 244 seconds]
<shevy>
Prawn::Document.generate("hello.pdf") do; text "Hello World!"
<shevy>
File.open or File.new... one of those two at the least, they make use of blocks meaning they will automatically call .close on the file handle
<RubyNewby123>
oh I appreciate that, as I know my example is a completely useless, it is just the product of trying to troubleshoot. So I thought it would be nice to pass the occasionally required logic for each choice as data but this example has lost that concept, all in an effort to get the bare minimum working as expected
<RubyNewby123>
thanks again
roamingdog has quit [Ping timeout: 250 seconds]
<RubyNewby123>
actually, there's one more thing I'm struggling with, am I able to reference an instance method of "main" from inside "choices"? or must I pass that as an argument, to inject the dependency
RegulationD has joined #ruby
<RubyNewby123>
specifically, I'm talking about the player object. In c# this is trivial but I've had issues here
<shevy>
I am sure it is simple in ruby too
<shevy>
right now I have no real idea to what part of the code you refer to
<shevy>
a lot of your code can be shortened
<shevy>
the stray returns should not be necessary either
<shevy>
puts "" is equivalent to puts, btw
<RubyNewby123>
I'm fascinated...
<RubyNewby123>
ok, gotcha
zacstewart has joined #ruby
<shevy>
what do you mean with main?
<RubyNewby123>
so specifically, I have a player class and a choices class, just after my player class definition, I've created a new instance of it, I want all instances of my choices class to be able to access the single player instance
<RubyNewby123>
I understand that when you define a variable outside of any custom defined class it is actually in a class "main"
<jhass>
you could assign it to a constant or global, but it's better to pass it explicitly
<RubyNewby123>
I may have misunderstood
<shevy>
I see
<shevy>
there are several ways to do this
RegulationD has quit [Ping timeout: 264 seconds]
<shevy>
actually jhass mentioned the two main ones that came to my mind :)
<jhass>
you also could make Player a singleton class if there's only ever one
<RubyNewby123>
jhass: I was reluctant to pass it explicitly as it would have to be done every time, though I considered a wrapper method that would do the work
nankyokusei has joined #ruby
macsteps has quit [Remote host closed the connection]
<jhass>
you could dumb down your Choice class to a mere data holder and have a new class that runs the game logic
<shevy>
RubyNewby123 well, you can check if the user passed in a class Player or whether it is a String
<jhass>
and says just replaces it's @current_choice variable
macsteps has joined #ruby
<jhass>
and also hold on to the player
<RubyNewby123>
I'm not sure I follow
ramfjord has joined #ruby
nankyokusei has quit [Ping timeout: 276 seconds]
macsteps has quit [Ping timeout: 240 seconds]
<RubyNewby123>
well either way, you guys have given me a lot to go on... I'll keep tinkering away, thank you so, so, so much
xxninjabunnyxx has quit [Quit: Leaving]
macsteps has joined #ruby
<jhass>
RubyNewby123: hang on a sec
sergey_makagon has joined #ruby
thomas_25 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<jhass>
took out the block stuff out again, just to get the idea across
xxninjabunnyxx has quit [Quit: Leaving]
banisterfiend has quit [Client Quit]
the_drow has quit [Quit: This computer has gone to sleep]
hahuang61 has joined #ruby
diegoviola has joined #ruby
<RubyNewby123>
wow ok, so right away I see you've seperated the concerns more logically, this is fantastic
sukra has joined #ruby
<RubyNewby123>
I'll need to study some of the other stuff but I think I get what you're doing
aryaching has joined #ruby
<RubyNewby123>
amazing stuff, thank you
djbkd has joined #ruby
<RubyNewby123>
what's "loop do"? Is that some sort of condition-less loop?
<RubyNewby123>
sorry that's probably googlable
hahuang61 has quit [Ping timeout: 250 seconds]
<Papierkorb>
RubyNewby123: It runs an infinite loop, calling the block until the block calls to `break` or `return` or something else which commonly breaks out of a loop
<baweaver>
as far as the three-deep function, way too vague.
<baweaver>
if we s/inject/reduce though and treat it as if you're trying to do functional pipelining on something though
jaguarma_ has joined #ruby
<et09>
that's basically it, just the functions being injected on the hash are basically "recursive_send" on an OpenStruct (recursive_send just being a bunch of .send's piled on top of each other)
bkxd has quit [Ping timeout: 240 seconds]
arup_r has left #ruby [#ruby]
jaguarmagenta has quit [Ping timeout: 260 seconds]
<baweaver>
coe: last chance. #ruby-offtopic for offtopic subjects.
<jhass>
coe: I have to ask you to stop being offtopic, /join #ruby-offtopic or /join #freenode and please stop talking here unless you have a question about the Ruby programming language