havenwood changed the topic of #ruby to: Rules & more: https://ruby-community.com | Ruby 2.7.0, 2.6.5, 2.5.7: https://www.ruby-lang.org | Paste 4+ lines of text to https://dpaste.de/ and select Ruby as the language | Rails questions? Ask in #RubyOnRails | Books: https://goo.gl/wpGhoQ | Logs: https://irclog.whitequark.org/ruby | Can't talk? Register/identify with Nickserv first!
chalkmonster has quit [Quit: WeeChat 2.7.1]
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
chalkmonster has joined #ruby
markong has quit [Ping timeout: 258 seconds]
LinuxKnight has joined #ruby
r3m has quit [Quit: WeeChat 2.8-dev]
chihhsin_ has joined #ruby
chihhsin has quit [Ping timeout: 260 seconds]
r3m has joined #ruby
pyrmont has quit [Quit: Disconnecting...]
pyrmont has joined #ruby
fanta1 has joined #ruby
Bounga has joined #ruby
schne1der has quit [Ping timeout: 258 seconds]
Bounga has quit [Ping timeout: 256 seconds]
i9zO5AP has joined #ruby
fluxAeon has quit [Ping timeout: 240 seconds]
Ai9zO5AP has quit [Ping timeout: 260 seconds]
SanguineAnomaly has quit [Ping timeout: 248 seconds]
yokel has joined #ruby
caterfxo has joined #ruby
SanguineAnomaly has joined #ruby
<d3bug> >>10.0.equal?(10.0)
<d3bug> >> 10.0.equal?(10.0)
sergioro has joined #ruby
titanbiscuit has quit [Ping timeout: 260 seconds]
fanta1 has quit [Quit: fanta1]
titanbiscuit has joined #ruby
<apotheon> &>> p Object
<rubydoc> # => Object... check link for more (https://carc.in/#/r/8one)
<apotheon> &>> 10.0.equal? 10.0 # d3bug
<rubydoc> # => true (https://carc.in/#/r/8onf)
titanbiscuit has quit [Quit: ZNC 1.7.4 - https://znc.in]
titanbiscuit has joined #ruby
jmcgnh has quit [Ping timeout: 265 seconds]
<d3bug> oh ok
<d3bug> gotta use the ampersand thingy
jmcgnh_ has joined #ruby
jmcgnh_ is now known as jmcgnh
wildtrees has quit [Quit: Leaving]
pupsikov has joined #ruby
LinuxKnight has quit [Ping timeout: 255 seconds]
pwnd_nsfw has quit [Read error: Connection reset by peer]
Doow has quit [Read error: Connection reset by peer]
Doow has joined #ruby
shokohsc has quit [Quit: Ping timeout (120 seconds)]
AndroidKitKat has quit [Remote host closed the connection]
shokohsc has joined #ruby
AndroidKitKat has joined #ruby
SeepingN has quit [Quit: The system is going down for reboot NOW!]
titanbiscuit has quit [Quit: ZNC 1.7.4 - https://znc.in]
titanbiscuit has joined #ruby
bambanx has joined #ruby
sagax has joined #ruby
<havenwood> We develop new principles for Ruby out of Ruby’s own principles. We do not say to Ruby: Cease your struggles, they are foolish; we will give you the true slogan of struggle. We merely show Ruby what it is really fighting for, and consciousness is something that it has to acquire, even if it does not want to.
titanbiscuit has quit [Ping timeout: 258 seconds]
orbyt_ has joined #ruby
pupsikov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pupsikov has joined #ruby
titanbiscuit has joined #ruby
Frobozz has joined #ruby
titanbiscuit has quit [Ping timeout: 256 seconds]
titanbiscuit has joined #ruby
titanbiscuit has quit [Ping timeout: 265 seconds]
titanbiscuit has joined #ruby
ewanchic has quit [Ping timeout: 258 seconds]
soulisson has joined #ruby
tbisker8 has joined #ruby
Bounga has joined #ruby
titanbiscuit has quit [Read error: Connection reset by peer]
soulisson has quit [Quit: Leaving]
tbisker8 has quit [Read error: Connection reset by peer]
Bounga has quit [Ping timeout: 272 seconds]
titanbiscuit has joined #ruby
kapil_ has joined #ruby
titanbiscuit has quit [Read error: Connection reset by peer]
titanbiscuit has joined #ruby
caterfxo has quit [Quit: leaving]
caterfxo has joined #ruby
ewanchic has joined #ruby
brool has joined #ruby
bambanx has quit [Quit: Leaving]
chalkmonster has quit [Quit: WeeChat 2.7.1]
pupsikov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pupsikov has joined #ruby
schne1der has joined #ruby
pinpox has quit [Ping timeout: 268 seconds]
gix has quit [Ping timeout: 255 seconds]
pupsikov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
alfiemax has joined #ruby
alfiemax has quit [Ping timeout: 258 seconds]
braincrash has quit [Quit: bye bye]
brool has quit [Ping timeout: 272 seconds]
d3bug has quit [Quit: Connection closed for inactivity]
braincrash has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
brool has joined #ruby
schne1der has quit [Quit: schne1der]
howdoi has quit [Quit: Connection closed for inactivity]
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
chalkmonster has joined #ruby
chalkmonster has quit [Client Quit]
martin290 has joined #ruby
martin290 has left #ruby [#ruby]
Bounga has joined #ruby
Bounga has quit [Ping timeout: 272 seconds]
meinside has joined #ruby
ewanchic has quit [Ping timeout: 258 seconds]
ewanchic has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
x0n has quit [Quit: ZNC - https://znc.in]
x0n has joined #ruby
Doow has quit [Ping timeout: 255 seconds]
ua has quit [Excess Flood]
ua has joined #ruby
ewanchic has quit [Ping timeout: 258 seconds]
TzilTzal has joined #ruby
<TzilTzal> Hi
yokel has quit [Ping timeout: 260 seconds]
johnny56 has quit [Ping timeout: 240 seconds]
cthulchu_ has quit [Ping timeout: 258 seconds]
<TzilTzal> I have a file that gets loaded several times during the auto-load sequence of Padrino... does anyone know why, or how to prevent that?
alfiemax has joined #ruby
johnny56 has joined #ruby
donofrio has quit [Remote host closed the connection]
yokel has joined #ruby
ewanchic has joined #ruby
glytchbinary has joined #ruby
chalkmonster has joined #ruby
bukkitgerman8 has quit [Quit: Ping timeout (120 seconds)]
yokel has quit [Ping timeout: 265 seconds]
cnsvc has joined #ruby
yokel has joined #ruby
trif has joined #ruby
swistak35 has quit [Ping timeout: 260 seconds]
kenichi has quit [Ping timeout: 260 seconds]
trif_ has quit [Ping timeout: 260 seconds]
tekk has quit [Ping timeout: 260 seconds]
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
sauvin has joined #ruby
tekk has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.7.1]
dionysus69 has joined #ruby
roadie has joined #ruby
glytchbinary has quit [Quit: glytchbinary]
i9zO5AP has quit [Quit: WeeChat 2.7.1]
titanbiscuit has quit [Ping timeout: 256 seconds]
titanbiscuit has joined #ruby
Bounga has joined #ruby
Bounga has quit [Ping timeout: 240 seconds]
markopasha has joined #ruby
markopasha has quit [Max SendQ exceeded]
markopasha has joined #ruby
bhaak has quit [Ping timeout: 255 seconds]
uplime- has quit [Ping timeout: 255 seconds]
uplime has joined #ruby
cd has quit [Quit: cd]
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #ruby
titanbiscuit has quit [Ping timeout: 256 seconds]
titanbiscuit has joined #ruby
s2013 has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
tosaraja has quit [Remote host closed the connection]
brool has quit [Ping timeout: 272 seconds]
titanbiscuit has quit [Ping timeout: 268 seconds]
chalkmonster has joined #ruby
titanbiscuit has joined #ruby
jmcgnh has quit [Read error: Connection reset by peer]
tbisker8 has joined #ruby
sdu has joined #ruby
titanbiscuit has quit [Read error: Connection reset by peer]
jmcgnh has joined #ruby
Bounga has joined #ruby
Bounga has quit [Remote host closed the connection]
Bounga has joined #ruby
tbisker8 has quit [Ping timeout: 258 seconds]
sdu has quit [Ping timeout: 260 seconds]
sdu has joined #ruby
MrCrackPot has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
lxsameer has joined #ruby
titanbiscuit has joined #ruby
sergioro has quit [Quit: leaving]
titanbiscuit has quit [Ping timeout: 258 seconds]
bruce_lee has joined #ruby
<al2o3-cr> thank crunchy it's friday!
xco has joined #ruby
stdedos has joined #ruby
iamdevnul has quit [Ping timeout: 260 seconds]
titanbiscuit has joined #ruby
iamdevnul has joined #ruby
tbisker8 has joined #ruby
titanbiscuit has quit [Ping timeout: 255 seconds]
donofrio has joined #ruby
TomyWork has joined #ruby
Bounga has quit [Ping timeout: 240 seconds]
cnsvc has joined #ruby
alexherbo2 has joined #ruby
fbandov has joined #ruby
fbandov has quit [Client Quit]
tbisker8 has quit [Ping timeout: 258 seconds]
titanbiscuit has joined #ruby
bhaak has joined #ruby
titanbiscuit has quit [Excess Flood]
cnsvc has quit [Ping timeout: 240 seconds]
titanbiscuit has joined #ruby
cnsvc has joined #ruby
tsujp has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
kinduff has quit [Read error: Connection reset by peer]
kinduff has joined #ruby
titanbiscuit has quit [Ping timeout: 256 seconds]
markopasha has quit [Remote host closed the connection]
postmodern has quit [Quit: Leaving]
titanbiscuit has joined #ruby
cnsvc has joined #ruby
titanbiscuit has quit [Ping timeout: 265 seconds]
titanbiscuit has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
titanbiscuit has quit [Excess Flood]
titanbiscuit has joined #ruby
titanbiscuit has quit [Read error: Connection reset by peer]
titanbiscuit has joined #ruby
titanbiscuit has quit [Ping timeout: 240 seconds]
LinuxKnight has joined #ruby
ellcs has quit [Remote host closed the connection]
ellcs has joined #ruby
sh7d has quit [Ping timeout: 240 seconds]
cnsvc has joined #ruby
sh7d has joined #ruby
DTZUZU2 has quit [Ping timeout: 256 seconds]
cnsvc has quit [Ping timeout: 240 seconds]
markong has joined #ruby
ellcs has quit [Remote host closed the connection]
edwardly has quit [Quit: ??????????]
ellcs has joined #ruby
MasterNayru has quit [Remote host closed the connection]
bvdw has quit [Read error: Connection reset by peer]
c0san0stra has quit [Ping timeout: 265 seconds]
bvdw has joined #ruby
woodruffw has quit [Ping timeout: 265 seconds]
olspookishmagus has quit [Ping timeout: 265 seconds]
kempo has quit [Ping timeout: 265 seconds]
pavelz has quit [Ping timeout: 265 seconds]
xpitr has quit [Ping timeout: 265 seconds]
thebetra1 has quit [Ping timeout: 265 seconds]
reaVer has quit [Ping timeout: 265 seconds]
umjisus has quit [Ping timeout: 265 seconds]
dorian has quit [Ping timeout: 265 seconds]
thebetra1 has joined #ruby
umjisus has joined #ruby
margeas has joined #ruby
c0san0stra has joined #ruby
edwardly has joined #ruby
markopasha has joined #ruby
markong has quit [Ping timeout: 265 seconds]
royal_screwup21 has joined #ruby
titanbiscuit has joined #ruby
alfiemax has quit [Remote host closed the connection]
DTZUZU2 has joined #ruby
markoong has joined #ruby
margeas has quit [Ping timeout: 260 seconds]
titanbiscuit has quit [Ping timeout: 268 seconds]
cnsvc has joined #ruby
crst has joined #ruby
<crst> Hi! Why do I get an undefinded_method error when calling a normal or private method in a "def self" method. (all within the same class)?
cnsvc has quit [Ping timeout: 240 seconds]
titanbiscuit has joined #ruby
<leftylink> the way you phrased it makes it sound like you're calling an instance method from a class method. but without code, I honestly cannot be sure
phaul has joined #ruby
<crst> leftylink: I'm sorry about my phrasing, here's the code: https://dpaste.org/osv2
<leftylink> well there you go. now we can see that you are calling an instance method (pad_and_validate) from a class method (import)
_phaul has quit [Ping timeout: 258 seconds]
stryek has joined #ruby
bruce_lee has quit [Ping timeout: 255 seconds]
<crst> All right thanks for clarifying. The code works when I move the pad_and_validate method outside the class but I'm not sure if I want to do that. What's the ruby way to handle a situation like this?
TCZ has joined #ruby
drincruz_ has joined #ruby
burningserenity has joined #ruby
tbisker8 has joined #ruby
titanbiscuit has quit [Ping timeout: 272 seconds]
tbisker8 has quit [Excess Flood]
titanbiscuit has joined #ruby
lucasb has joined #ruby
_phaul has joined #ruby
titanbiscuit has quit [Read error: Connection reset by peer]
phaul has quit [Ping timeout: 265 seconds]
titanbiscuit has joined #ruby
TCZ has quit [Quit: Leaving]
drincruz_ has quit [Ping timeout: 265 seconds]
olddogbarks has joined #ruby
royal_screwup21 has quit [Remote host closed the connection]
TCZ has joined #ruby
drincruz_ has joined #ruby
titanbiscuit has quit [Ping timeout: 240 seconds]
titanbiscuit has joined #ruby
cnsvc has joined #ruby
alfiemax has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
burningserenity has quit [Ping timeout: 256 seconds]
paraxial has quit [Quit: The Lounge - https://thelounge.chat]
burningserenity has joined #ruby
paraxial has joined #ruby
paraxial has quit [Client Quit]
jcalla has joined #ruby
paraxial has joined #ruby
alfiemax has quit [Remote host closed the connection]
paraxial has quit [Client Quit]
woodruffw has joined #ruby
paraxial has joined #ruby
titanbiscuit has quit [Ping timeout: 240 seconds]
olddogbarks has quit [Quit: ZZZzzz…]
TCZ has quit [Quit: Leaving]
spiette has quit [Quit: ZNC 1.7.5 - https://znc.in]
leitz has joined #ruby
sdu has quit [Remote host closed the connection]
spiette has joined #ruby
royal_screwup21 has joined #ruby
olddogbarks has joined #ruby
sdu has joined #ruby
titanbiscuit has joined #ruby
paraxial has quit [Quit: The Lounge - https://thelounge.chat]
olddogbarks has quit [Quit: ZZZzzz…]
olspookishmagus has joined #ruby
olddogbarks has joined #ruby
titanbiscuit has quit [Ping timeout: 258 seconds]
titanbiscuit has joined #ruby
paraxial has joined #ruby
cnsvc has joined #ruby
titanbiscuit has quit [Ping timeout: 265 seconds]
titanbiscuit has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
d3bug has joined #ruby
titanbiscuit has quit [Ping timeout: 256 seconds]
titanbiscuit has joined #ruby
fercell has joined #ruby
titanbiscuit has quit [Excess Flood]
titanbiscuit has joined #ruby
olddogbarks has quit [Quit: ZZZzzz…]
olddogbarks has joined #ruby
fluxAeon has joined #ruby
tbisker8 has joined #ruby
titanbiscuit has quit [Ping timeout: 255 seconds]
roadie has quit [Read error: Connection reset by peer]
roadie has joined #ruby
roadie has quit [Ping timeout: 255 seconds]
burningserenity has quit [Ping timeout: 255 seconds]
meinside has quit [Quit: Connection closed for inactivity]
burningserenity has joined #ruby
kapil_ has quit [Quit: Connection closed for inactivity]
burningserenity has quit [Ping timeout: 240 seconds]
olddogbarks has quit [Quit: I am functioning within established parameters.]
burningserenity has joined #ruby
royal_screwup21 has quit [Remote host closed the connection]
fercell has quit [Quit: WeeChat 2.7.1]
royal_screwup21 has joined #ruby
hutch has joined #ruby
SeepingN has joined #ruby
cnsvc has joined #ruby
<xco> hi how do i convert "455" to 445.0 without the use of Float and to_f?
<_phaul> &>> 455 * 1.0
<rubydoc> # => 455.0 (https://carc.in/#/r/8oqn)
<havenwood> xco: Why avoid #Float?
<_phaul> not that I understand why it's a requirement to avoid those..
<xco> want implementation myself
cnsvc has quit [Ping timeout: 240 seconds]
<havenwood> &>> "455".to_i.fdiv(1)
<rubydoc> # => 455.0 (https://carc.in/#/r/8oqo)
<havenwood> xco: There's no real "implement myself" for making a Float. I mean you could use Fiddle, but there's no point other than for fun.
<al2o3-cr> &>> [455].pack('f').unpack1('f')
<rubydoc> # => 455.0 (https://carc.in/#/r/8oqp)
<_phaul> &>> Math.exp(Math.log(455)) # close enough :)
<rubydoc> # => 454.99999999999994 (https://carc.in/#/r/8oqq)
<rubydoc> parser error at position 0 around `w'
<havenwood> &was >> "455".to_i.digits.each_with_index.reduce(0.0) { |acc, (n, i)| acc + 10 ** i * n }
<havenwood> &>> "455".to_i.digits.each_with_index.reduce(0.0) { |acc, (n, i)| acc + 10 ** i * n }
<rubydoc> # => 455.0 (https://carc.in/#/r/8oqr)
kenichi has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
duderonomy has joined #ruby
duderonomy has quit [Client Quit]
<al2o3-cr> how's everyone doing anyway, good?
leitz has quit [Quit: Leaving]
royal_screwup21 has quit [Remote host closed the connection]
cnsvc has joined #ruby
<al2o3-cr> xco: why do you want to implement this yourself?
<xco> :)
<havenwood> &>> ObjectSpace._id2ref(280208339315458050)
<rubydoc> # => 455.0 (https://carc.in/#/r/8org)
cnsvc has quit [Ping timeout: 240 seconds]
roadie has joined #ruby
<havenwood> xco: This is an easy problem to solve in Ruby with #Float. I'd suggest switching to challenges that have tests. :)
<havenwood> xco: Instead of trying to make easy things hard, solve harder things.
<xco> havenwood thanks :). so I failed a job interview. It's easy, the interviewer said I can't use Float or #to_f
<havenwood> xco: That's just a very bad interview question for Ruby. ¯\_(ツ)_/¯ I'd fail it too, I suppose?
<havenwood> xco: I mean, you can backbend to technically meet that requirement.
<xco> :( that's why i'm jobless. the instructions don't mention anywhhere that you can use float etc
<xco> havenwood makes me feel a bit better thanks :)
<havenwood> xco: Technical interviews are a coin toss. You may have to do several to get a sane one.
<xco> i'm still trying
<_phaul> I am really curious to see their solution. The question doesn't make sense.. They say you should parse. But into what? I guess techniqually you could split on '.' parse the two integers on left and right and put them together into a single float
<havenwood> xco: Have you done some exercism challenges in Ruby yet? https://exercism.io/
<xco> _phaul i did all those, he said "no" :/
<_phaul> xco you are lucky not working for them ;)
ellcs has quit [Ping timeout: 256 seconds]
<al2o3-cr> "455".to_i * 1.0 is the simplest solution.
leitz has joined #ruby
<xco> this is for a Ruby on Rails position btw :D, once I had another interview for a Rails position where the interview spent like 35min squeezing me to spit out how blockchain works
<_phaul> al2o3-cr: I guess you fail to "parse" "3.14"
<xco> al2o3-cr he said you can't use #to_i on a group of numbers, just one digit like so "3".to_i
<leitz> al2o3-cr, in response to your "how is everyone doing" question, the answer is "not bad, but mildly stressed." I keep seeing the need to prepare for a job change.
<al2o3-cr> oh, i should skim
roadie has quit [Read error: Connection reset by peer]
<al2o3-cr> leitz: why?
<al2o3-cr> xco: ask them how long is a peice of string.
cnsvc has joined #ruby
<al2o3-cr> xco: that's a stupid question you'll never need, and just testing *your* logic.
<xco> havenwood i did a few tests on exercism, most are not hard i'd say
<xco> what i don't get is why don't they test my knowledge of Rails? :P i'd pass easily :D :D
sdu has quit [Remote host closed the connection]
<al2o3-cr> xco: not necessarily.
<xco> al2o3-cr but i'm on codewars a lot, it's similar to exercism i guess or not? most questions require you to write algos
<al2o3-cr> havenwood: that's a good one though ;)
<al2o3-cr> xco: what kata you on?
cnsvc has quit [Ping timeout: 240 seconds]
<xco> i'd have to check
<xco> 7?
<xco> or 6
<al2o3-cr> so, you've only just started really.
<xco> just checked 6kyu
<xco> al2o3-cr which one are you one?
<al2o3-cr> xco: i can't remember off hand but some get crazy hard.
<leitz> al2o3-cr, the contract end is coming, the new hasn't been awarded, and mgmt is making goo-goo eyes at a competing set of products.
<al2o3-cr> it's years ago a toyed with codewars ;)
<xco> yeah those get hard sometimes hahaha, it's not hard if you have time to think, and time is expensive
* leitz is still just 6 kyu on codewars
<xco> _phaul hahaha ok! give me an hour or two, got a headache from my failed interview
hutch has quit [Ping timeout: 272 seconds]
<xco> _phaul that looks easy, bookmarked to do during the weekend :P
lucasb has quit [Quit: Connection closed for inactivity]
postmodern has joined #ruby
hutch has joined #ruby
<havenwood> *spoiler* _phaul: my solution to your problem :)
<_phaul> oh. now we have produce :) it was born pre-produce times
<havenwood> I like katas. \o/
s2013 has joined #ruby
<al2o3-cr> havenwood: very nice solution! now pass the kata ;)
<xco> havenwood that's cool! :D
<xco> ** runs to google what Enumerator.produce does **
<TzilTzal> Should config/database.rb include an establish_connection call? It seems as though rake db:create goes through that file...
<xco> TzilTzal maybe this should be in Rails IRC? just saying :P
<TzilTzal> oh, sorry. true )
<al2o3-cr> TzilTzal: but if someone knows in here they'll probably answer too. :)
<dreamreal> I've got an rspec return value that looks like ... .to_return(body: { data: { id: 'foo' } }.to_json) but .. what type is that? A hash uses arrows, not that faux json syntax...
<_phaul> it's a syntactic sugar for symbol keys
<_phaul> { :a => 1 } is equivalent to { a: 1 }
cnsvc has joined #ruby
<dreamreal> I'm not sure I understand (by which I mean: "I don't understand")
<_phaul> { :a => 1 } is a hash that maps symbol :a to 1. { a: 1 } is an other way of writing the same.
<_phaul> are you familiar with symbols in ruby?
<havenwood> &>> {a: 1}
<rubydoc> # => {:a=>1} (https://carc.in/#/r/8orh)
<dreamreal> Well... I thought so but apparently not.
<al2o3-cr> dreamreal: a symbol in ruby is an interned string
<dreamreal> okay, so you're creating a hash with 'a' as a key and 1 as a value, yes?
cnsvc has quit [Ping timeout: 240 seconds]
<_phaul> with :a as a key. 'a' is a string. :a is a symbol
<_phaul> different types
dionysus69 has quit [Quit: dionysus69]
<dreamreal> okay, so you'd have a *variable* a, and it'd use that variable's value as the key for the hash?
<havenwood> &>> {a: 1}.keys.first.class
<rubydoc> # => Symbol (https://carc.in/#/r/8ori)
<havenwood> &>> {a: 1}.keys.first
<rubydoc> # => :a (https://carc.in/#/r/8orj)
hutch has quit [Ping timeout: 256 seconds]
<_phaul> dreamreal: symbols have nothing to do with variables. it's just a type like string or integer. Think of it as constant string
<dreamreal> okay, so I'm still lost as to what that rspec is doing, because there's no "body" in scope
<havenwood> dreamreal: Symbols are like a number wearing a name tag. They don't store text, they just happen to use a bit of it in their name tag.
<havenwood> "Symbols in Ruby are for identifiers. They are kind of like Enums in other languages such as Swift or C# (although Symbols are more primitive)." -Matz
<dreamreal> What I'm trying to do, apart from master ruby in 30 seconds or less (obviously!) is extract that data structure into an external JSON file so I can just load it instead of having a line 5k chars wide
<havenwood> "Symbols are a simple way to get a unique named identifier, and Strings represent arbitrary data/text." -Jeremy Evans
<havenwood> dreamreal: Symbols are popular for keys in Ruby, but they can't be straightforwardly represented in JSON. There are a couple patterns you can use to deserialize to Symbols keys rather than String keys.
<havenwood> &>> require 'json'; JSON.parse("{\"aim\":true}", symbolize_names: true)
<rubydoc> # => {:aim=>true} (https://carc.in/#/r/8ork)
howdoi has joined #ruby
<havenwood> That's ^ one good way.
<dreamreal> *nod* I'm trying to generate JSON from this ruby structure, though, and I'm not sure where the keys are coming from if they're using the colon operator
<dreamreal> I may just leave it; it works, it's just gross and it's going to have to be repeated
<ytti> i've thought symbols as immutable strings
<ytti> but perhaps name for a number is better way to think them
<_phaul> ytti: it's a close enough estimation imho, at least from what the language user can observe. Internally they are special
<havenwood> Jeremy Evans and Matz argue they're different than frozen strings, so Symbol and String can't be unified. There are a couple bugs.ruby-lang.org issues where attempts to unify are refused.
d3bug has quit [Quit: Connection closed for inactivity]
roadie has joined #ruby
hutch has joined #ruby
LenPayne_ has quit [Quit: ZNC 1.7.5 - https://znc.in]
cnsvc has joined #ruby
grym has joined #ruby
grym has left #ruby [#ruby]
DTZUZU2 is now known as DTZUZU
kashike has quit [Ping timeout: 260 seconds]
<al2o3-cr> "foo".intern puts that string into a symbol table internally as an unsigned long.
<dreamreal> I still don't quite understand how this data structure is working. >:(
<dreamreal> I mean, I get hashes, no worries; I just don't understand how this spec is generating json from this data structure's definition
<al2o3-cr> dreamreal: what don't you get?
jmcgnh has quit [Quit: ZNC 1.7.5 - https://znc.in]
href has joined #ruby
<dreamreal> it's got a line: .to_return(body: {data: {id: '1568'} }.to_json) ... yet if I copy that argument to a new ruby file (so I can generate JSON from it) I get syntax errors
<al2o3-cr> {a: 1} is the same as {:a => 1}
<_phaul> &>> require 'json' ; { body: {data: {id: '1568'} }}.to_json
<rubydoc> # => "{\"body\":{\"data\":{\"id\":\"1568\"}}}" (https://carc.in/#/r/8orq)
href has quit [Client Quit]
<dreamreal> but that's.. not working for me
cnsvc has quit [Ping timeout: 240 seconds]
jmcgnh has joined #ruby
<al2o3-cr> dreamreal: well, there is something else a miss.
<dreamreal> oh wait... WTF, maybe it is
<_phaul> btw. if I gave the wroong impression I am ful heartedly against symbol / string unification :D I thought that was a way to explain it without going into too much detail. But maybe it over simplifies too much
cthulchu_ has joined #ruby
jmcgnh_ has joined #ruby
jmcgnh has quit [Ping timeout: 260 seconds]
jmcgnh_ is now known as jmcgnh
crst has quit [Quit: Leaving...]
alexherbo2 has quit [Quit: The Lounge - https://thelounge.chat]
kashike has joined #ruby
creat has quit [Quit: ZNC - http://znc.in]
pupsikov has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
schne1der has joined #ruby
bvdw has joined #ruby
TomyWork has quit [Remote host closed the connection]
pupsikov has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sphex_ has quit [Remote host closed the connection]
creat has joined #ruby
gix has joined #ruby
sphex has joined #ruby
dinfuehr has quit [Quit: ZNC 1.6.6+deb1ubuntu0.2 - http://znc.in]
dinfuehr has joined #ruby
cnsvc has joined #ruby
old_relik has joined #ruby
<old_relik> hi, I have an initial array like this: [50, 100, 250, 500, 1000, 2000, 3000, 4000, 5000]
<old_relik> I want to add more elements to this array if an input value is 10_000
<old_relik> to be + [10000, 20000]
<ytti> &>> [50, 100, 250, 500, 1000, 2000, 3000, 4000, 5000] + [10000, 20000]
<old_relik> if it's 9000, then [10_000]
<rubydoc> # => [50, 100, 250, 500, 1000, 2000, 3000, 4000, 5000, 10000, 20000] (https://carc.in/#/r/8os0)
<leftylink> indeed, one can use + with two arrays to create a new one. one can use << to mutate an array by adding an element as well
<old_relik> if it's 21000, then [10000, 20000, 30000] etc.
<havenwood> old_relik: Why [10000, 20000, 30000] if 21000?
<old_relik> one extra +10k
<ytti> i guess 21000 > 20k
<ytti> 10k > 9k
<ytti> so next round multiple of 10k
<old_relik> can't find a succint way of doing this
<old_relik> I'll post what I have right now, one sec
<old_relik> what's the standard pastebin?
<ytti> add multiples of 10k until exeeding input number
<ytti> is what i'm reading
<havenwood> old_relik: gist.github.com or dpaste.de
<ytti> &&> n=32000;a=[];(n / 10000)+1.times { |i| a << 10000 * (i+1) };p a
<rubydoc> parser error at position 0 around `&'
<ytti> &>> n=32000;a=[];(n / 10000)+1.times { |i| a << 10000 * (i+1) };p a
<rubydoc> # => [10000]... check link for more (https://carc.in/#/r/8os3)
<ytti> &>> n=32000;a=[];((n / 10000)+1).times { |i| a << 10000 * (i+1) };p a
<rubydoc> # => [10000, 20000, 30000, 40000]... check link for more (https://carc.in/#/r/8os5)
<old_relik> this works fine, except it doesn't add the additional 10_000 at the end
<old_relik> if it's less than 5000, it should add nothing
<ytti> i feel like there will be more rules coming with more solutions presented :>
<havenwood> old_relik: Show a gist with all the cases you want to cover?
<old_relik> one sec
<ytti> yeah the actual problem might be more fruitful
<ytti> instead of solution you're thinking right now
kinduff has quit [Read error: Connection reset by peer]
<old_relik> there's no actual problem written anywhere, I just want it to behave this way
kinduff has joined #ruby
<old_relik> the comments show what I want as intended output
<old_relik> not what it is doing right now
<old_relik> I can solve it, there's no problem, I'm just trying to find a succint way to do it
kinduff7 has joined #ruby
<leftylink> so if you say the only problem is that it doesn't add the next-largest multiple of 10000, we can run with that. note that Enumerable#find is able to find the first element of an enumerable that meets a predicate
hutch has quit [Ping timeout: 272 seconds]
<leftylink> or there's the more direct way with division and ceil
rippa has joined #ruby
TzilTzal has quit [Quit: Leaving.]
kinduff has quit [Ping timeout: 260 seconds]
kinduff7 is now known as kinduff
<old_relik> that's right that the only problem currently
<old_relik> I can just stick a 10_000 at the end
<old_relik> if n > 5000
<old_relik> wait, no
<old_relik> ugh
<old_relik> that only solves one case
kinduff8 has joined #ruby
<old_relik> I need to stick an additional +10_000 to the last element if the number is greater than 5000, if it's exactly between 5000..10_000, then only stick a 10_000
<old_relik> that's v hacky
<havenwood> old_relik: I didn't look at your cases, but for the first, here are some ideas: https://gist.github.com/havenwood/48b5eacc187e44ad4f8b77bc590d1406
<havenwood> old_relik: It doesn't handle edge cases like an empty array, but I don't really understand what you're solving so no clue which edge cases matter.
<old_relik> empty array is fine, that can be handled separately
<old_relik> trying your solution
<leftylink> I don't see 5000..10_000 as a special case
<leftylink> all cases are handled by "first multiple of 10000 that is larger"
kinduff has quit [Ping timeout: 260 seconds]
kinduff8 is now known as kinduff
<havenwood> leftylink: I'm distracted and I think I ignored the criteria. >.>
<leftylink> strictly larger, clarifying
<havenwood> I just riffed off the first example.
<leftylink> I have not determined whether you ignored the criteria or not
<leftylink> I'll allow the concerned parties to make that determination
<leftylink> yes, that's a euphemism
<old_relik> Tried to write a problem statement: If the input is within the bounds of the max of the SEED array, then return the original array. If the input is more than the max of the SEED array, then incrementally assign +10_000 such that the input is sandwich'd between the last two values of the sorted SEED array.
<old_relik> Not sure if that makes sense
<old_relik> So, if it's 4000, the SEED array will be returned as is. If it's 5000 or 6k, then last two values will be [5000, 1000], if it's 11000, the last 2 values will be [10000, 20000] and so on
codefriar has joined #ruby
ur5us has joined #ruby
wildtrees has joined #ruby
wildtrees has quit [Max SendQ exceeded]
<old_relik> ok
<old_relik> I think this works https://dpaste.org/ePo6#L4,9,11,12,14,15,17,18,20,21,23,24,27
wildtrees has joined #ruby
wildtrees has left #ruby [#ruby]
wildtrees has joined #ruby
jmcgnh has quit [Read error: Connection reset by peer]
Emmanuel_Chanel has quit [Ping timeout: 268 seconds]
jmcgnh has joined #ruby
old_relik has quit [Remote host closed the connection]
sauvin has quit [Read error: Connection reset by peer]
orbyt_ has joined #ruby
nixy371 has quit [Quit: The Lounge - https://thelounge.chat]
royal_screwup21 has joined #ruby
TCZ has joined #ruby
code_zombie has joined #ruby
Emmanuel_Chanel has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
schne1der has quit [Quit: schne1der]
codefriar has quit [Quit: Textual IRC Client: www.textualapp.com]
hiroaki has joined #ruby
nowhere_man has joined #ruby
romanblanco has joined #ruby
smccarthy has joined #ruby
<smccarthy> I am trying to run rspec programmatically (in AWS). My lambda function is in /var/task , but it downloads the tests to /tmp. Is there a way to run rspec programmatically from a different directory ?
nowhereman has joined #ruby
nowhere_man has quit [Ping timeout: 258 seconds]
<adam12> smccarthy: Maybe you could manipulate your load path? cd /tmp; rspec -I /var/task
hiroaki has quit [Ping timeout: 272 seconds]
priodev has quit [Ping timeout: 260 seconds]
cnsvc has joined #ruby
glytchbinary has joined #ruby
cnsvc has quit [Ping timeout: 240 seconds]
cnsvc has joined #ruby
glytchbinary has quit [Ping timeout: 255 seconds]
LenPayne has joined #ruby
Xiti has quit [Quit: Leaving]
alexherbo2 has joined #ruby
royal_screwup21 has quit [Remote host closed the connection]
e21 has joined #ruby
ur5us has quit [Ping timeout: 240 seconds]
royal_screwup21 has joined #ruby
Dirak has joined #ruby
roadie has quit [Read error: Connection reset by peer]
<_phaul> what makes me curious is how whitequark managed to og this before it happened https://freenode.irclog.whitequark.org/ruby/2020-03-06#26523736; maybe some quantum physics :)
<_phaul> log*
royal_screwup21 has quit [Remote host closed the connection]
<Dirak> wow well written ruby can be beautiful. What are some projects I can study that are just pure ruby without rails?
hiroaki has joined #ruby
<al2o3-cr> _phaul: how?
<_phaul> haven said &was >> by mistake. the bot reacted with parser error. in the logs it's out of order
<_phaul> I dont know how...
psmolen has quit [Ping timeout: 268 seconds]
<al2o3-cr> &asm>> 2 << 2
<rubydoc> I have disassembled your code, the result is at https://carc.in/#/r/8oty
markopasha has quit [Remote host closed the connection]
psmolen has joined #ruby
<al2o3-cr> &>> &>>
<rubydoc> stderr: -e:4: syntax error, unexpected &... check link for more (https://carc.in/#/r/8otz)
caterfxo has quit [Ping timeout: 240 seconds]
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
markopasha has joined #ruby
caterfxo has joined #ruby
burningserenity has quit [Remote host closed the connection]
royal_screwup21 has joined #ruby
kinduff has quit [*.net *.split]
gix has quit [*.net *.split]
paraxial has quit [*.net *.split]
olspookishmagus has quit [*.net *.split]
johnny56 has quit [*.net *.split]
chihhsin_ has quit [*.net *.split]
jinie has quit [*.net *.split]
mozzarella has quit [*.net *.split]
jidar has quit [*.net *.split]
mkaito_ has quit [*.net *.split]
sevvie has quit [*.net *.split]
z4phod has quit [*.net *.split]
m27frogy has quit [*.net *.split]
hramrach has quit [*.net *.split]
Fraeon has quit [*.net *.split]
lypsis has quit [*.net *.split]
Xeago has quit [*.net *.split]
fmccann_ has quit [*.net *.split]
PaulePanter has quit [*.net *.split]
rprimus has quit [*.net *.split]
llua has quit [*.net *.split]
shaman42 has quit [*.net *.split]
IsoLinCHiP has quit [*.net *.split]
antholog has quit [*.net *.split]
IcyDragon has quit [*.net *.split]
go|dfish has quit [*.net *.split]
hagabaka has quit [*.net *.split]
lnx has quit [*.net *.split]
kke has quit [*.net *.split]
Koshian has quit [*.net *.split]
jidar has joined #ruby
Xeago has joined #ruby
sevvie has joined #ruby
kinduff has joined #ruby
paraxial has joined #ruby
gix has joined #ruby
jinie has joined #ruby
hramrach has joined #ruby
m27frogy has joined #ruby
z4phod has joined #ruby
chihhsin_ has joined #ruby
Fraeon has joined #ruby
mkaito_ has joined #ruby
lypsis has joined #ruby
fmccann_ has joined #ruby
lnx has joined #ruby
llua has joined #ruby
IcyDragon has joined #ruby
hagabaka has joined #ruby
IsoLinCHiP has joined #ruby
kke has joined #ruby
antholog has joined #ruby
shaman42 has joined #ruby
rprimus has joined #ruby
go|dfish has joined #ruby
Koshian has joined #ruby
alexherbo24 has joined #ruby
Xeago has quit [Max SendQ exceeded]
jinie has quit [Max SendQ exceeded]
Xeago has joined #ruby
jinie has joined #ruby
mozzarella has joined #ruby
alexherbo2 has quit [Ping timeout: 265 seconds]
alexherbo24 is now known as alexherbo2
johnny56 has joined #ruby
kinduff has quit [Quit: Ping timeout (120 seconds)]
smccarthy has quit [Remote host closed the connection]
kinduff has joined #ruby
kinduff has quit [Client Quit]
Dirak has quit [Ping timeout: 265 seconds]
Dirak has joined #ruby
TCZ has quit [Quit: Leaving]
wildtrees has quit [Ping timeout: 260 seconds]
psmolen has quit [Ping timeout: 256 seconds]
Xiti has joined #ruby
shakes has joined #ruby
<Dirak> is there a "The book" for learning Ruby? For example, "The book" for Javascript would be "You don't know Javascript"
bvdw has quit [Quit: bvdw]
<_phaul> there is an old list:
<_phaul> &books
<rubydoc> parser error at position 0 around `b'
<_phaul> &? books
<rubydoc> You can find a list of recommended books at http://ruby-community.com/pages/links
ur5us has joined #ruby
bvdw has joined #ruby
<_phaul> and there is a ist that ba*weaver maintains which is more up to date.
psmolen has joined #ruby
soulisson has joined #ruby
<soulisson> Hello
<soulisson> Is the new method, Class.new a static method?
<_phaul> for "the book" and that is subjectibe I would go with the pixkaxe book of Dave Thomas
<leftylink> &ri Class#new
<leftylink> therefore, no, it's an instance method on the Class class
<leftylink> not to be confused with Class's class method new
<leftylink> &ri Class::new
<rubydoc> Found no entry that matches class Class::new
<leftylink> &ri Class.new
<leftylink> which makes sense, right
<leftylink> as can be seen in
<leftylink> &>> class A; end; A.method(:new).owner
<rubydoc> # => Class (https://carc.in/#/r/8ou0)
<leftylink> so we can clearly see it must be an instance method of Class
<_phaul> I think you are going deeper than it needs to be here....
<leftylink> I see.
<_phaul> new is "like" a static methods in c++, and it would call alllocate the object + initialize instance method in sequence. but to gain a full understanding you would need to understand leftylink's points
<soulisson> I really thought new was a class method :(
xpitr has joined #ruby
<_phaul> it is.
<_phaul> class A; end; A.new; you send the new to the class, no question about that. It allocates a new instance of A and calls initialize on that object
<soulisson> _phaul, ok, that's what I understood. But I think I misunderstood leftylink point
<_phaul> it's going deeper a bit more involved, and I think leftylink was getting into that..
<_phaul> if you have a free hour this should enlighten a lot more https://www.youtube.com/watch?v=X2sgQ38UDVY
<soulisson> ok, thanks
Bounga has joined #ruby
shakes has quit [Quit: Leaving]
Bounga has quit [Ping timeout: 256 seconds]
olspookishmagus has joined #ruby
brool has joined #ruby
<soulisson> _phaul, I have a stupid question (I don't have theorical basis in CS). Is a dictionary object is it self a dictionary data structure or is it an object that represents a dictionary data structure?
ur5us has quit [Quit: Leaving]
markopasha has quit [Remote host closed the connection]
alexherbo2 has quit [Remote host closed the connection]
ur5us has joined #ruby
e2 has joined #ruby
caterfxo has quit [Quit: leaving]
<_phaul> I don'tunderstand the question, sorry
<leftylink> I wonder what is the difference between those two
* baweaver stares
<soulisson> I'm going to try to rephrase it but it's not easy.
<soulisson> The definition I have of a data structure is the following: an organized set of data/item. Is the object {'soulisson' => 'soulisson@irc.org'} is what is called a dictionary data structure?
<soulisson> (Sorry for my english)
noboruma has joined #ruby
<_phaul> in CS there are many different approaches to dscribe the world. One is OO (object oriented) and in OO we think of objects as data and behaviour. what you are showing is purely data, when stored in a hash or map or as you call it a dictionary it's data. The dictionary has a map to things to things, but it's not what we think as objects, having said that - confusingly these dictionaries are objetcs
caterfxo has joined #ruby
<soulisson> ok, thanks
<_phaul> I really wasn't sure if i made sense :D
<soulisson> I suck at programming despite my numerous years in the IT world :(
<soulisson> sometimes it's discouraging
e21 has quit [Quit: Textual IRC Client: www.textualapp.com]
nowhereman has quit [Ping timeout: 260 seconds]
markoong has quit [Ping timeout: 265 seconds]
markong has joined #ruby
ur5us has quit [Ping timeout: 256 seconds]
RiPuk has quit [Ping timeout: 260 seconds]
RiPuk has joined #ruby
orbyt_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ur5us has joined #ruby
margeas has joined #ruby
markong has quit [Ping timeout: 255 seconds]
markoong has joined #ruby
margeas has quit [Ping timeout: 255 seconds]
dostoyevsky has quit [Quit: leaving]
dostoyevsky has joined #ruby
x0n- has joined #ruby
x0n has quit [Ping timeout: 258 seconds]