00:02
dan64 has joined #ruby
00:07
cow[moo] has joined #ruby
00:11
dpl_ has quit [Ping timeout: 240 seconds]
00:27
pwnd_ has quit [Read error: Connection reset by peer]
00:27
pwnd_ has joined #ruby
00:35
gray-_-wolf has joined #ruby
00:43
jetchisel has quit [Ping timeout: 252 seconds]
00:46
jetchisel has joined #ruby
00:46
jenrzzz_ has quit [Ping timeout: 252 seconds]
01:04
neshpion has joined #ruby
01:05
jenrzzz_ has joined #ruby
01:11
Rudd0 has quit [Ping timeout: 252 seconds]
01:12
jenrzzz has quit [Ping timeout: 252 seconds]
01:13
jenrzzz_ has quit [Ping timeout: 265 seconds]
01:15
kinduff has quit [Read error: Connection reset by peer]
01:16
kinduff has joined #ruby
01:16
Technodrome has joined #ruby
01:16
kinduff has quit [Read error: Connection reset by peer]
01:17
kinduff has joined #ruby
01:17
kinduff has quit [Read error: Connection reset by peer]
01:18
kinduff has joined #ruby
01:19
jenrzzz has joined #ruby
01:23
jenrzzz has quit [Ping timeout: 240 seconds]
01:31
jenrzzz has joined #ruby
01:38
jenrzzz_ has joined #ruby
01:41
jenrzzz has quit [Ping timeout: 252 seconds]
01:49
centrx has joined #ruby
01:55
jenrzzz has joined #ruby
02:01
jenrzzz has quit [Ping timeout: 260 seconds]
02:12
jenrzzz has joined #ruby
02:20
TomyLobo has quit [Read error: Connection reset by peer]
02:25
jenrzzz has quit [Ping timeout: 245 seconds]
02:30
jenrzzz has joined #ruby
02:34
jenrzzz has quit [Ping timeout: 245 seconds]
02:38
wallacer has quit [Ping timeout: 250 seconds]
02:41
jenrzzz_ has quit [Ping timeout: 245 seconds]
02:43
ChmEarl has quit [Quit: Leaving]
02:49
jenrzzz has joined #ruby
02:55
jenrzzz has quit [Ping timeout: 265 seconds]
02:56
pwnd_0 has joined #ruby
02:57
pwnd_ has quit [Ping timeout: 260 seconds]
02:57
pwnd_0 is now known as pwnd_
03:00
MalkbabY_ has joined #ruby
03:03
MalkbabY has quit [Ping timeout: 265 seconds]
03:08
jenrzzz has joined #ruby
03:08
jenrzzz_ has joined #ruby
03:19
gix- has joined #ruby
03:19
gix has quit [Disconnected by services]
03:20
jenrzzz_ has quit [Ping timeout: 252 seconds]
03:20
jenrzzz_ has joined #ruby
03:22
robotbee has quit [Ping timeout: 240 seconds]
03:22
yuesbeez has quit [Quit: Connection closed for inactivity]
03:23
jenrzzz has quit [Ping timeout: 245 seconds]
03:26
jenrzzz_ has quit [Ping timeout: 240 seconds]
03:32
nixue has quit [Quit: Connection closed]
03:39
barg has quit [Read error: Connection reset by peer]
03:41
barg has joined #ruby
03:44
jenrzzz has joined #ruby
03:45
jenrzzz_ has joined #ruby
03:50
jenrzzz has quit [Ping timeout: 246 seconds]
03:50
centrx has quit [Remote host closed the connection]
03:51
jenrzzz_ has quit [Ping timeout: 246 seconds]
04:00
jenrzzz has joined #ruby
04:02
m27frogy has quit [Ping timeout: 252 seconds]
04:04
jenrzzz has quit [Ping timeout: 240 seconds]
04:05
cd has quit [Quit: cd]
04:06
robotbee has joined #ruby
04:11
jenrzzz has joined #ruby
04:12
neshpion has quit [Quit: neshpion]
04:13
jenrzzz_ has joined #ruby
04:17
jenrzzz has quit [Ping timeout: 252 seconds]
04:20
jenrzzz_ has quit [Ping timeout: 260 seconds]
04:23
CoolerX has joined #ruby
04:23
<
CoolerX >
where does the Formula class come from?
04:23
<
CoolerX >
there are no load statements
04:24
robotbee has quit [Ping timeout: 252 seconds]
04:31
jenrzzz has joined #ruby
04:32
jenrzzz_ has joined #ruby
04:37
jenrzzz has quit [Ping timeout: 245 seconds]
04:47
jenrzzz_ has quit [Ping timeout: 245 seconds]
04:49
centrx has joined #ruby
04:52
CoolerX has quit [Ping timeout: 240 seconds]
04:53
centrx has quit [Ping timeout: 245 seconds]
04:56
hiroaki has quit [Ping timeout: 260 seconds]
04:56
jenrzzz has joined #ruby
05:00
prestorium has quit [Ping timeout: 240 seconds]
05:01
jenrzzz_ has joined #ruby
05:02
jenrzzz has quit [Ping timeout: 265 seconds]
05:04
prestorium has joined #ruby
05:04
centrx has joined #ruby
05:08
centrx has quit [Ping timeout: 250 seconds]
05:09
jla has joined #ruby
05:14
TorpedoSkyline has joined #ruby
05:17
<
leftylink >
too bad, I only just looked into it and found the answer to the question
05:18
<
leftylink >
looks like I won't get to answer it now
05:21
jenrzzz has joined #ruby
05:21
robotbee has joined #ruby
05:25
jenrzzz_ has quit [Ping timeout: 245 seconds]
05:26
jenrzzz has quit [Ping timeout: 240 seconds]
05:35
drusepth has quit [Ping timeout: 240 seconds]
05:38
gix- has quit [Ping timeout: 240 seconds]
05:53
pyra has quit [Quit: Konversation terminated!]
05:56
centrx has joined #ruby
06:01
centrx has quit [Ping timeout: 250 seconds]
06:05
centrx has joined #ruby
06:05
jenrzzz has joined #ruby
06:06
ur5us__ has quit [Ping timeout: 250 seconds]
06:07
hiroaki has joined #ruby
06:09
centrx_ has joined #ruby
06:10
jenrzzz has quit [Ping timeout: 245 seconds]
06:10
centrx has quit [Ping timeout: 245 seconds]
06:11
jenrzzz has joined #ruby
06:12
centrx has joined #ruby
06:13
jla has quit [Ping timeout: 240 seconds]
06:13
centrx_ has quit [Ping timeout: 245 seconds]
06:15
centrx_ has joined #ruby
06:16
jenrzzz has quit [Ping timeout: 245 seconds]
06:17
centrx has quit [Ping timeout: 245 seconds]
06:17
postmodern has quit [Quit: Leaving]
06:18
jenrzzz has joined #ruby
06:19
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
06:19
centrx_ has quit [Ping timeout: 250 seconds]
06:22
jenrzzz_ has joined #ruby
06:25
teclator has joined #ruby
06:31
robotbee has quit [Ping timeout: 268 seconds]
06:32
centrx has joined #ruby
06:34
centrx_ has joined #ruby
06:36
centrx has quit [Ping timeout: 250 seconds]
06:39
centrx_ has quit [Ping timeout: 245 seconds]
06:42
centrx has joined #ruby
06:43
jenrzzz has quit [Ping timeout: 252 seconds]
06:43
feriman has joined #ruby
06:46
centrx_ has joined #ruby
06:46
jla has joined #ruby
06:46
jenrzzz has joined #ruby
06:47
centrx has quit [Ping timeout: 245 seconds]
06:48
centrx has joined #ruby
06:50
centrx_ has quit [Ping timeout: 245 seconds]
06:51
al2o3-cr has quit [Quit: WeeChat 3.1]
06:52
centrx has quit [Ping timeout: 250 seconds]
06:52
centrx has joined #ruby
06:54
jenrzzz has quit [Ping timeout: 240 seconds]
06:55
dpl_ has joined #ruby
06:55
jenrzzz has joined #ruby
06:56
centrx_ has joined #ruby
06:57
centrx has quit [Ping timeout: 245 seconds]
07:00
centrx has joined #ruby
07:01
centrx_ has quit [Ping timeout: 245 seconds]
07:02
vondruch has joined #ruby
07:02
vondruch has quit [Remote host closed the connection]
07:03
vondruch has joined #ruby
07:03
centrx_ has joined #ruby
07:05
centrx has quit [Ping timeout: 250 seconds]
07:08
centrx_ has quit [Ping timeout: 245 seconds]
07:11
jenrzzz has quit [Ping timeout: 240 seconds]
07:15
MalkbabY has joined #ruby
07:15
evdubs__ has joined #ruby
07:18
evdubs_ has quit [Ping timeout: 245 seconds]
07:18
jenrzzz_ has quit [Ping timeout: 240 seconds]
07:19
MalkbabY_ has quit [Ping timeout: 268 seconds]
07:20
drusepth has joined #ruby
07:22
centrx has joined #ruby
07:23
evdubs_ has joined #ruby
07:24
TomyWork has joined #ruby
07:25
jenrzzz has joined #ruby
07:25
centrx_ has joined #ruby
07:25
evdubs__ has quit [Ping timeout: 245 seconds]
07:27
centrx has quit [Ping timeout: 250 seconds]
07:29
centrx_ has quit [Ping timeout: 245 seconds]
07:32
jenrzzz has quit [Ping timeout: 252 seconds]
07:33
evdubs__ has joined #ruby
07:34
centrx has joined #ruby
07:34
pyra has joined #ruby
07:35
evdubs_ has quit [Ping timeout: 260 seconds]
07:38
centrx has quit [Ping timeout: 245 seconds]
07:40
centrx has joined #ruby
07:40
evdubs_ has joined #ruby
07:43
evdubs__ has quit [Ping timeout: 240 seconds]
07:44
evdubs__ has joined #ruby
07:44
centrx has quit [Ping timeout: 245 seconds]
07:46
evdubs_ has quit [Ping timeout: 240 seconds]
07:46
jenrzzz has joined #ruby
07:47
jenrzzz_ has joined #ruby
07:49
centrx has joined #ruby
07:51
centrx_ has joined #ruby
07:54
centrx has quit [Ping timeout: 245 seconds]
07:55
gearnode has joined #ruby
07:55
centrx_ has quit [Ping timeout: 245 seconds]
07:58
evdubs_ has joined #ruby
08:01
evdubs__ has quit [Ping timeout: 240 seconds]
08:02
evdubs__ has joined #ruby
08:04
evdubs_ has quit [Ping timeout: 240 seconds]
08:12
jenrzzz has quit [Ping timeout: 240 seconds]
08:14
drusepth has quit [Ping timeout: 252 seconds]
08:14
BSaboia has joined #ruby
08:19
jla has quit [Ping timeout: 268 seconds]
08:24
maxmanders has quit [Ping timeout: 260 seconds]
08:24
AutomationD has quit [Ping timeout: 250 seconds]
08:24
sorah has quit [Ping timeout: 258 seconds]
08:24
graphicsv has quit [Ping timeout: 245 seconds]
08:24
coffeejunk has quit [Read error: Connection reset by peer]
08:24
podman has quit [Read error: Connection reset by peer]
08:24
JayDoubleu has quit [Read error: Connection reset by peer]
08:24
peteretep has quit [Read error: Connection reset by peer]
08:24
Guest45273 has quit [Read error: Connection reset by peer]
08:27
dcunit3d has joined #ruby
08:28
dcunit3d has left #ruby [#ruby]
08:29
maxmanders has joined #ruby
08:29
sorah has joined #ruby
08:29
peteretep has joined #ruby
08:30
gray-_-wolf has quit [Quit: WeeChat 3.1]
08:30
coffeejunk has joined #ruby
08:30
JayDoubleu has joined #ruby
08:30
AutomationD has joined #ruby
08:30
podman has joined #ruby
08:30
Guest45273 has joined #ruby
08:30
graphicsv has joined #ruby
08:31
graphicsv has quit [Excess Flood]
08:32
jenrzzz has joined #ruby
08:32
graphicsv has joined #ruby
08:34
CoolerX has joined #ruby
08:36
jenrzzz has quit [Ping timeout: 240 seconds]
08:39
shtirlic has quit [Remote host closed the connection]
08:40
ur5us__ has joined #ruby
08:48
dcunit3d has joined #ruby
08:54
centrx has joined #ruby
08:56
jenrzzz has joined #ruby
08:58
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
09:00
centrx has quit [Ping timeout: 250 seconds]
09:09
vondruch has quit [Quit: vondruch]
09:09
vondruch has joined #ruby
09:14
AndreYuhai has joined #ruby
09:16
jenrzzz has quit [Ping timeout: 252 seconds]
09:16
jinie has joined #ruby
09:18
jenrzzz_ has quit [Ping timeout: 265 seconds]
09:19
pyra has quit [Quit: Konversation terminated!]
09:20
BTRE has quit [Ping timeout: 260 seconds]
09:23
BTRE has joined #ruby
09:26
jinie has joined #ruby
09:28
shtirlic has joined #ruby
09:32
centrx has joined #ruby
09:32
<
CoolerX >
anyone here?
09:33
<
CoolerX >
The definition for the Formula class is not in that file and there are no load statements to load it
09:33
<
CoolerX >
so how does it work?
09:33
lightstalker has quit [Ping timeout: 245 seconds]
09:34
jenrzzz has joined #ruby
09:36
centrx has quit [Ping timeout: 245 seconds]
09:38
jenrzzz has quit [Ping timeout: 240 seconds]
09:39
lightstalker has joined #ruby
09:39
centrx has joined #ruby
09:43
centrx_ has joined #ruby
09:44
centrx has quit [Ping timeout: 250 seconds]
09:44
vondruch has quit [Read error: Connection reset by peer]
09:44
vondruch has joined #ruby
09:47
centrx_ has quit [Ping timeout: 245 seconds]
09:47
centrx has joined #ruby
09:49
krma has joined #ruby
09:50
krma has left #ruby [#ruby]
09:51
centrx has quit [Ping timeout: 250 seconds]
09:54
kwilczynski has quit []
09:54
kwilczynski has joined #ruby
09:59
brigitte is now known as aloy
10:00
evdubs_ has joined #ruby
10:00
infinityfye has joined #ruby
10:02
evdubs__ has quit [Ping timeout: 240 seconds]
10:06
centrx has joined #ruby
10:07
<
leftylink >
well, your concerns would be well-founded in that that file would not work by itself
10:08
wallacer has joined #ruby
10:08
TCZ has joined #ruby
10:08
<
leftylink >
so we are forced to assume that homebrew arranges for this to be the case
10:11
<
leftylink >
a given source file doesn't have to be the one to require and/or load other source files it depends on. of course, it can lead to confusion if it doesn't, since then of course it would only work if some other mechanism has required and/or loaded them. so I don't like to do that. but whether I like it or not is irrelevant
10:12
centrx has quit [Ping timeout: 245 seconds]
10:12
<
leftylink >
nobody asked me whether I like it or not
10:13
<
CoolerX >
leftylink, ok thanks
10:14
<
CoolerX >
leftylink, is there a common place to find the docs for that?
10:14
<
CoolerX >
for homebrew library
10:14
<
leftylink >
if we are talking about homebrew, I do not knowl homebrew well enough to provide an answer for this question
10:15
<
CoolerX >
is there a convention on how docs are done in ruby?
10:15
<
CoolerX >
like python has docstrings inline with the code
10:16
<
CoolerX >
and other languages have their own conventions, does Ruby have some convention?
10:17
<
leftylink >
I've not yet seen there be a single prevailing convention for this language, but I know that various projects use
https://yardoc.org/ . for the particulars of any given project it may be most useful to take a look at a few files in that project to see how that project does it
10:17
<
AndreYuhai >
Oh yea leftylink has already posted :)
10:23
<
CoolerX >
In this code should there be double/single quotes around protein in the initialize method?
https://bpa.st/CRZA
10:23
<
CoolerX >
@protein = 'protein'
10:24
<
CoolerX >
shouldn't*
10:26
centrx has joined #ruby
10:31
centrx has quit [Ping timeout: 250 seconds]
10:33
vondruch has quit [Ping timeout: 260 seconds]
10:35
<
CoolerX >
well I tried the code and it seems to set it to nil
10:36
<
CoolerX >
oh actually nvm, I didn't notice the protein variable in the parameter list
10:36
centrx has joined #ruby
10:36
<
CoolerX >
now it makes sense
10:38
centrx_ has joined #ruby
10:39
centrx__ has joined #ruby
10:41
centrx has quit [Ping timeout: 245 seconds]
10:42
centrx_ has quit [Ping timeout: 245 seconds]
10:44
centrx__ has quit [Ping timeout: 250 seconds]
10:46
jla has joined #ruby
10:47
centrx has joined #ruby
10:48
cuerbot has quit [Read error: Connection reset by peer]
10:50
elcuervo has joined #ruby
10:52
ur5us__ has quit [Ping timeout: 250 seconds]
10:53
AndreYuhai has quit [Ping timeout: 260 seconds]
10:55
feriman has quit [Quit: WeeChat 3.1]
11:01
evdubs__ has joined #ruby
11:01
m27frogy has joined #ruby
11:03
<
CoolerX >
ecommence, not sure what first_or_create! is on line 19
11:03
<
ecommence >
Nevermind, I'm gonna stop using "first_or_create!"
11:03
<
ecommence >
CoolerX: hehe nice timing :D
11:03
<
CoolerX >
but I think you probably meant to call it on an instance?
11:03
evdubs_ has quit [Ping timeout: 245 seconds]
11:04
<
ecommence >
yeah i think so, my bad!
11:06
<
ecommence >
completely misunderstood the meaning of first there
11:14
AndreYuhai has joined #ruby
11:17
evdubs__ has quit [Read error: Connection reset by peer]
11:18
evdubs__ has joined #ruby
11:23
vondruch has joined #ruby
11:28
MalkbabY_ has joined #ruby
11:31
MalkbabY has quit [Ping timeout: 240 seconds]
11:54
<
CoolerX >
does anyone know why this works
11:54
<
CoolerX >
x = lambda {|y| y + 2}
11:55
queip has quit [Ping timeout: 252 seconds]
11:55
<
CoolerX >
but this doesn't?
11:55
<
CoolerX >
x = lambda({|y| y + 2}
11:55
<
CoolerX >
x = lambda({|y| y + 2})
11:55
<
AndreYuhai >
Because those are two different things AFAIK CoolerX
11:55
<
AndreYuhai >
In the first one you are passing a block
11:55
<
CoolerX >
I guess the block has to come after the arguments to lambda
11:55
<
CoolerX >
AndreYuhai, yeah
11:55
<
AndreYuhai >
In the second one you are trying to pass an argument
11:56
<
CoolerX >
so what arguments does lambda take?
11:56
<
CoolerX >
anything?
11:59
<
AndreYuhai >
CoolerX: So lambda is equal to Proc.new, and Proc does not take any arguments AFAIK
12:00
TCZ has quit [Quit: ...]
12:02
wallacer has quit [Ping timeout: 250 seconds]
12:04
vondruch has quit [Ping timeout: 260 seconds]
12:04
<
leftylink >
&>> method(:lambda).owner
12:04
wallacer has joined #ruby
12:05
<
havenwood >
AndreYuhai: #proc is equivalent to Proc.new
12:05
<
havenwood >
lambdas are a bit different form a procs
12:06
<
AndreYuhai >
havenwood: lambda is not?
12:06
<
AndreYuhai >
Oh I didn't know that
12:06
jerme_ has quit [Quit: Connection closed for inactivity]
12:06
<
havenwood >
AndreYuhai: proc {}.lambda? #=> false
12:06
<
havenwood >
AndreYuhai: lambda {}.lambda? #=> true
12:07
<
havenwood >
AndreYuhai: lambdas have strict arity and different locality of return.
12:08
<
havenwood >
AndreYuhai: it doesn't usually matter
12:11
<
AndreYuhai >
havenwood: so the difference is in how they respond to certain calls and how they behave?
12:11
queip has joined #ruby
12:12
<
havenwood >
AndreYuhai: how strict they are with arguments and how they return out of methods, yeah
12:12
<
AndreYuhai >
havenwood: btw, on line 49 in that gist, how is :ended_early returned after break?
12:12
<
havenwood >
and how they respond to #lambda? too :P
12:12
<
AndreYuhai >
yea :D
12:12
<
AndreYuhai >
I get the lambda one on line 53 which I would expect
12:14
<
AndreYuhai >
But I don't know how that happens on line 49
12:15
<
havenwood >
AndreYuhai: there's an idea called "Tennent's Correspondence Principle" that in practice just means make it super confusing :P
12:15
<
havenwood >
AndreYuhai: it's just different ways to return that end up being more for fun than for important use cases
12:16
<
havenwood >
AndreYuhai: Ruby has lots of options ¯\_(ツ)_/¯
12:18
TCZ has joined #ruby
12:18
<
CoolerX >
why can you put random stuff in a class definition?
12:18
<
CoolerX >
well not random
12:18
<
CoolerX >
but just statements
12:19
<
CoolerX >
when it's run it prints those thigns
12:19
<
leftylink >
for the same reason you can put `def` in a class definition
12:19
<
leftylink >
because if you couldn't put things in class definitions, you wouldn't be able to put anything in a class
12:20
<
CoolerX >
what? I am not saying you shouldn't be able to put def inthere
12:20
<
leftylink >
good, neither am I
12:21
<
CoolerX >
sorry, I didn't understand your point
12:21
<
AndreYuhai >
havenwood: Oh I just realized that it was just an argument to break? I was thinking there is ";" in between :D
12:21
<
CoolerX >
yes def should be there you can define instance and class methods
12:21
<
CoolerX >
but why are other things allowed?
12:21
<
leftylink >
why should they not be allowed? why would def be treated differently than anything else?
12:22
<
CoolerX >
because def is a keyword?
12:22
<
CoolerX >
puts is not
12:22
<
leftylink >
if other things weren't allowed, how would things like attr_accessor?
12:22
<
leftylink >
how would things like attr_reader work?
12:22
<
leftylink >
how would things like include or extend work?
12:22
<
CoolerX >
so basically you can put everything in a class Foo end block?
12:23
<
CommunistWolf >
because ruby is suffer :D
12:23
<
CommunistWolf >
class Foo; Net::HTTP.get .... ; # use the output to define some methods, why not?
12:29
TCZ has quit [Quit: ...]
12:29
vondruch has joined #ruby
12:29
jla has quit [Ping timeout: 245 seconds]
12:32
<
leftylink >
hmm, it's gotten me thinking. I too am curious baout this question
12:34
centrx has quit [Remote host closed the connection]
12:35
centrx has joined #ruby
12:37
<
CoolerX >
if the function returns something does that do anything to the class ?
12:37
<
CoolerX >
like I am wondering if attr_accessors works by returning some methods or something
12:39
centrx has quit [Ping timeout: 250 seconds]
12:40
<
leftylink >
although attr_accessor is implemented in C, if it weren't, I am imagining it would be possible to implement it with define_method
12:41
<
leftylink >
&ri Module#define_method
12:42
Fernando-Basso has joined #ruby
12:44
jla has joined #ruby
12:45
<
ccooke >
CoolerX: The key point is that Ruby is a pretty much purely imperative language. Every statement in the language is executed when a block is processed, every statement has a return value, etc. You don't define a class so much as you run a piece of code which creates the structure of the class imperatively
12:46
<
ccooke >
(A bit old, but still useful)
12:48
<
CoolerX >
btw 'foo' => :bar
12:48
<
CoolerX >
is that a hash with a single entry?
12:48
<
CoolerX >
don't you need {'foo' => :bar } ?
12:48
<
CoolerX >
the curly braces
12:50
<
ccooke >
It will get passed to the method as a keyword argument
12:50
Azure has quit [Ping timeout: 245 seconds]
12:52
<
CoolerX >
ccooke, so that is the same as depends_on foo: :bar
12:52
<
ccooke >
Not quite. Example:
12:52
<
ccooke >
3.0.0 :011 > def foo(**kw) p kw; end
12:53
<
ccooke >
3.0.0 :012 > foo 'bar' => :baz
12:53
<
ccooke >
{"bar"=>:baz}
12:53
<
ccooke >
=> {"bar"=>:baz}
12:53
<
ccooke >
3.0.0 :013 > foo bar: :baz
12:53
<
ccooke >
{:bar=>:baz}
12:53
<
ccooke >
=> {:bar=>:baz}
12:53
<
ccooke >
3.0.0 :014 >
12:53
<
ccooke >
bah. Tmux copy issue again :-/ Sorry about the long lines
12:53
jla has quit [Ping timeout: 260 seconds]
12:54
<
CoolerX >
is same as depends_on("pkg-config": :build)
12:54
<
ccooke >
the difference is that it's passing a string as the key, not a symbol
12:54
<
ccooke >
so yes, if you use a string key, it will be the same
12:55
<
CoolerX >
def depends_on("pkg-config": "default value")
12:56
<
ccooke >
That's a bit different. IIRC you can't have a string literal
*defined* keyword argument
12:56
<
ccooke >
(if you did, how could you tell?)
12:56
<
CoolerX >
so what is the actual depends_on ?
12:56
<
CoolerX >
def depends_on(**kw)
12:56
<
ccooke >
you can have string keys in the
*undefined* key arguments hash
12:59
<
ccooke >
the `foo: 'bar'` syntax is a short-form in ruby. The actual hash syntax is defined as { key => value }. The short-form is a quick way to use symbols as keys, which are nice and efficient. You can now use string keys that way, too, but these are still short-forms of the canonical => definition
13:00
<
ccooke >
Ruby methods can take a hash as the last parameter, and when doing so you may omit the curly brackets. It is, however, a normal hash for parsing and will work with the short-hand style or the canonical style
13:01
<
ccooke >
the 'string': :value syntax is newer in Ruby; previously, hashrockets were the only way to pass a string keyword argument to a method
13:01
<
ccooke >
There could be a number of reasons why the code you're looking at does that
13:01
<
ccooke >
Personally, I think most of them are bad reasons, mind, and this looks inconsistent which is bad for maintainability
13:02
<
ccooke >
(*personally* I would prefer to use the shorthand form only, and convert Symbol to String when needed)
13:02
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
13:03
<
ccooke >
But it's actually possible you have a bit of code archaeology on your hands - I haven't looked at the project you're examining, but it may be old enough to predate the short: 'form' hash style - that's been around for a few years, but not so long that there aren't viable projects that predate it
13:03
cow[moo] has joined #ruby
13:03
vondruch has quit [Ping timeout: 252 seconds]
13:04
<
ccooke >
So you might actually have code where new work has been updated but older line are untouched
13:04
<
CoolerX >
ccooke, right
13:04
<
CoolerX >
homebrew-core is pretty old
13:04
<
CoolerX >
started in 2009
13:04
<
ccooke >
CoolerX: Those are examples of class methods, yes
13:05
<
CoolerX >
why not just have instance variables you can set?
13:05
<
CoolerX >
or override
13:05
<
CoolerX >
in the Formula class
13:06
<
ccooke >
it's quite likely that these methods are implemented that way
13:06
<
ccooke >
but this is providing some encapsulation, which makes things more consistent and reusable
13:08
<
ccooke >
Also, one of the advantages of the imperative style of class definition is that you can easily have code that generates a whole set of things like that.
13:08
<
leftylink >
bI suppose you can also argue that `desc "better CD Encoder"` is a few characters shorter than e.g. `@desc = "Better CD Encoder"`
13:08
<
ccooke >
and it allows validation where needed
13:17
Fernando-Basso has quit [Remote host closed the connection]
13:18
Fernando-Basso has joined #ruby
13:24
fernando-basso_ has joined #ruby
13:24
Fernando-Basso has quit [Quit: May the force]
13:25
fernando-basso_ is now known as fernando-basso
13:29
Xiti` has joined #ruby
13:32
Xiti has quit [Ping timeout: 252 seconds]
13:35
vondruch has joined #ruby
13:36
jla has joined #ruby
13:45
CoolerX has quit [Read error: Connection reset by peer]
13:45
CoolerX has joined #ruby
13:50
centrx has joined #ruby
13:51
jla has quit [Ping timeout: 246 seconds]
13:51
jimms has joined #ruby
13:52
cthulchu has joined #ruby
13:53
Technodrome has joined #ruby
14:07
wallacer has quit [Ping timeout: 250 seconds]
14:12
harlin has quit [Quit: Leaving]
14:14
wallacer has joined #ruby
14:14
rubydoc has quit [Ping timeout: 240 seconds]
14:15
phaul has quit [Ping timeout: 240 seconds]
14:19
<
centrx >
ecommence: Look for something like x[], that x is FalseClass when it should be an array/enumerable
14:20
<
centrx >
ecommence: Might be a configuration option that is the wrong type
14:21
wallacer has quit [Ping timeout: 245 seconds]
14:24
<
ecommence >
centrx: the user/app i added in myself
14:25
wallacer has joined #ruby
14:28
<
ecommence >
not sure i want it after all. just more code to maintain :D
14:32
cd has joined #ruby
14:40
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
14:43
cow[moo] has joined #ruby
14:45
jetchisel has quit [Ping timeout: 246 seconds]
14:57
phaul has joined #ruby
14:58
rubydoc has joined #ruby
15:06
<
centrx >
ecommence: Also try to get a trace for that, will tell you exactly where the error occurs. Logs? Command-line option (verbose) for Puma?
15:06
qewr has joined #ruby
15:11
jla has joined #ruby
15:16
Azure has joined #ruby
15:16
<
ecommence >
centrx: great idea!
15:22
AndreYuhai has quit [Quit: leaving]
15:22
duderonomy has joined #ruby
15:32
Guest45273 has quit []
15:33
Guest45273 has joined #ruby
15:34
Guest45273 has quit [Client Quit]
15:34
rann has joined #ruby
15:37
MalkbabY has joined #ruby
15:38
klaas has joined #ruby
15:39
MalkbabY_ has quit [Ping timeout: 240 seconds]
15:40
klaas has quit [Client Quit]
15:43
klaas has joined #ruby
15:53
aef has quit [Read error: Connection reset by peer]
16:01
miah has quit [Quit: DevOps? DerpOps maybe!]
16:02
rubydoc has quit [Remote host closed the connection]
16:02
rubydoc has joined #ruby
16:04
miah has joined #ruby
16:06
miah has quit [Client Quit]
16:06
miah has joined #ruby
16:11
rubydoc has quit [Ping timeout: 268 seconds]
16:11
phaul has quit [Ping timeout: 260 seconds]
16:13
vondruch has quit [Read error: Connection reset by peer]
16:14
fernando-basso has quit [Quit: May the force]
16:15
fernando-basso has joined #ruby
16:17
SeepingN has joined #ruby
16:33
phaul has joined #ruby
16:34
rubydoc has joined #ruby
16:34
ChmEarl has joined #ruby
16:39
jla has quit [Ping timeout: 268 seconds]
16:40
gix has joined #ruby
16:45
phaul has quit [Ping timeout: 252 seconds]
16:45
phaul has joined #ruby
16:49
crankharder has joined #ruby
16:55
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
17:03
TomyWork has quit [Remote host closed the connection]
17:04
jimms has quit [Quit: Leaving]
17:05
jenrzzz has joined #ruby
17:12
rubydoc has quit [Ping timeout: 246 seconds]
17:12
rubydoc has joined #ruby
17:18
jenrzzz has quit [Ping timeout: 240 seconds]
17:20
arekushi has joined #ruby
17:20
cthu| has joined #ruby
17:23
cthulchu has quit [Ping timeout: 240 seconds]
17:32
yuesbeez has joined #ruby
17:34
klaas has joined #ruby
17:36
<
rapha >
is there anything i can put `"blah".chars[right_here]` so that the result will be `nil`?
17:37
<
rapha >
(nil doesn't work => no implicit conversion; -1 doesn't work => means "last one", i.e. "h"; 0 ofc doesn't work => means "first one", i.e. "b" ... etc.)
17:37
<
leftylink >
well, a number larger than the array would be nil
17:37
<
leftylink >
coming up with a number that's certainly larger than the array may or may not be convenient though
17:38
<
rapha >
i think that might work
17:42
robotbee has joined #ruby
17:42
<
adam12 >
rapha: Out of curiosity, what are you trying to do at a higher level?
17:46
<
rapha >
adam12: going through a list of words word by word and char by char, getting myself the previous and following char as context, if any
17:46
<
rapha >
(but if none, need a space; which make it a little more involged)
17:47
<
adam12 >
rapha: Ah. Presumingly, you’ve seen chars.each_cons(3) ?
17:48
SegFaultAX has left #ruby [#ruby]
17:48
<
havenwood >
rapha: what about emoji?
17:48
<
rapha >
#each_cons o_O
17:48
* rapha
looks that up
17:48
<
adam12 >
&>> “blah”.chars.each_cons(3).to_a
17:48
<
rubydoc >
stderr: -e:4:in `<main>': undefined local variable or method `“blah”' for main:Object (NameError)... check link for more (
https://carc.in/#/r/azl3 )
17:48
<
rapha >
havenwood: no emojis is guaranteed for this 1025 y/o text.
17:48
<
havenwood >
rapha: phew
17:48
<
adam12 >
Huh interesting. My IRC client seems to want to do it’s own thing I guess.
17:49
<
havenwood >
rapha: I still prefer #each_grapheme_cluster :)
17:49
* adam12
slaps adam12 around a bit with a large trout
17:49
<
rapha >
woaaaaaaaaaaaaaaaaaaah
17:49
<
rapha >
i love her love her love her
17:49
<
rapha >
how AWESOME a method is that
17:49
<
havenwood >
&>> "bl🇸🇲ah".each_grapheme_cluster.each_cons(3).to_a
17:49
<
rapha >
thank you for that adam12 :)
17:49
<
rapha >
WOAAAAAH!!!!
17:50
<
rapha >
omg omg omg
17:50
drusepth has joined #ruby
17:50
<
rapha >
how amazing can a programming language be?!
17:50
Technodrome has joined #ruby
17:50
* rapha
won't even count the number of lines this took up until right now
17:50
<
adam12 >
Only issue I see is possibly the first element isn’t correct. In theory it would be [prev, current, next], but the first is wrong.
17:51
<
adam12 >
Might be worth exploring tho, anyways. Maybe padding by whitespace on either side or something.
17:51
<
adam12 >
or some sort of null...
17:51
<
rapha >
yeah something like that must work
17:52
<
havenwood >
rapha: Don't do this but Ruby is flexible enough to do all sorts of things:
17:52
<
havenwood >
&>> class String; include Enumerable; alias each each_grapheme_cluster end; 'rapha'.each_cons(3).to_a
17:53
<
rapha >
but yeah that shows what adam said
17:53
jenrzzz has joined #ruby
17:53
<
rapha >
also a last one ['h', 'a', ' '] is missing
17:54
jla has joined #ruby
17:54
<
havenwood >
^>> 'rapha'.prepend(' ').<<(' ').each_grapheme_cluster.each_cons(3).to_a
17:54
<
havenwood >
#=> [[" ", "r", "a"], ["r", "a", "p"], ["a", "p", "h"], ["p", "h", "a"], ["h", "a", " "]]
17:54
<
rapha >
hey don't do my work for me!!! :-P
17:55
<
havenwood >
rapha: nicer to have nils probably, like adam12 suggests
17:55
<
havenwood >
&>> [].prepend(nil).append(nil)
17:55
<
rapha >
how metaphysically philosophical!
17:56
<
rapha >
"if there is nothing at either end, and nothing in between, then what is there"?
17:56
<
havenwood >
rapha: 2
17:57
<
rapha >
douglas adams would've been proud of you havenwood
17:58
<
havenwood >
rapha: the size is two and the count is two but the count of itself is zero
17:58
<
havenwood >
&>> [].prepend(nil).append(nil).count(&:itself)
17:58
<
havenwood >
&>> [].prepend(nil).append(nil).size
17:58
<
havenwood >
Sometimes when you count yourself you end up with less than your size.
17:58
<
rapha >
even richard feynman would've been proud!!!
18:03
<
adam12 >
I think each_cons was lifted from SmallTalk. I swear I saw an example of it in the Smalltalk Best Practices book just recently.
18:09
jla has quit [Ping timeout: 240 seconds]
18:09
moldorcoder7 has quit [Ping timeout: 240 seconds]
18:09
<
adam12 >
Oooh. each_cons on steroids.
18:10
moldorcoder7 has joined #ruby
18:18
Azure has quit [Ping timeout: 252 seconds]
18:18
Azure|dc has joined #ruby
18:21
CoolerX has quit [Read error: Connection reset by peer]
18:21
CoolerX has joined #ruby
18:23
Iarfen has joined #ruby
18:30
moldorcoder7 has quit [Ping timeout: 240 seconds]
18:31
Azure|dc has quit [Read error: Connection reset by peer]
18:34
wallacer has quit [Ping timeout: 245 seconds]
18:38
moldorcoder7 has joined #ruby
18:43
JaredCE has joined #ruby
18:44
<
JaredCE >
i'm trying to run a bundle install for a project but i'm getting: Retrying fetcher due to error (2/4): Bundler::Fetcher::CertificateFailureError Could not verify the SSL certificate
18:44
drusepth has quit [Ping timeout: 252 seconds]
18:57
py88 has quit [Read error: Connection reset by peer]
18:57
<
adam12 >
JaredCE: bundle —version; gem —version
18:58
<
adam12 >
There’s a ton of recent SSL discussion about this on the Rubygems github repo.
18:58
<
JaredCE >
i'm newish to ruby
18:59
jla has joined #ruby
18:59
<
adam12 >
JaredCE: How did you install Ruby?
19:00
<
havenwood >
JaredCE: Can you install a ca-certificates package?
19:00
<
havenwood >
JaredCE: And what adam12 asked.
19:00
<
JaredCE >
brew install rbenv then rbenv install in the package dir
19:01
<
adam12 >
JaredCE: Which ruby version?
19:01
<
adam12 >
JaredCE: And can you get me the output of the line above? bundle —version ; gem —version
19:01
<
adam12 >
It’s versions all the way down.
19:02
<
adam12 >
JaredCE: Try `gem update —system` first.
19:02
<
adam12 >
That’s a double-hyphen in case it doesnt’ come across correctly.
19:02
<
JaredCE >
Bundler version 1.17.2 && gem 3.0.3
19:02
<
havenwood >
JaredCE: 2.6.7 is the latest version of Ruby 2.6.
19:02
<
havenwood >
JaredCE: brew upgrade
19:03
<
JaredCE >
it's an rbenv install? the .ruby-version file specifies 2.6.6?
19:03
py88 has joined #ruby
19:03
<
havenwood >
JaredCE: bump .ruby-version to 2.6.7
19:03
<
havenwood >
JaredCE: and same in the Gemfile
19:04
<
JaredCE >
gem update --system results in: ERROR: SSL verification error at depth 1: self signed certificate in certificate chain (19)
19:04
<
havenwood >
JaredCE: It's odd to get these issues with ruby-build since it ships its own OpenSSL.
19:05
<
havenwood >
JaredCE: Try installing Ruby with ruby-install instead?
19:05
BSaboia has quit [Quit: This computer has gone to sleep]
19:06
<
havenwood >
JaredCE: ruby-install -j4 --latest --install-dir ~/.rbenv/versions/2.6.7 ruby 2.6.7
19:08
drakonis has joined #ruby
19:08
<
havenwood >
JaredCE: Switching to RVM or chruby with ruby-install are ways around the problem. Or you could try updating ruby-build or installing 2.6.7 with ruby-build.
19:08
<
havenwood >
JaredCE: Since ruby-build ships its own OpenSSL, an update to it and reinstall might solve the problem.
19:08
drakonis has left #ruby ["WeeChat 3.1"]
19:09
<
JaredCE >
:( i downloaded a project written in ruby, i just wanted to mess around and try and add to the project... didn't think i'd have to go through this
19:09
<
havenwood >
JaredCE: You chose rbenv and it happened to run into a very odd error.
19:09
<
havenwood >
JaredCE: ¯\_(ツ)_/¯
19:10
<
JaredCE >
i mean i didn't choose it... the project told me to use it
19:10
<
havenwood >
JaredCE: What project?
19:11
<
havenwood >
JaredCE: SSL certs can get funky in any language. Unsure why you got unlucky here.
19:12
<
JaredCE >
output from the curl
19:12
<
havenwood >
JaredCE: That's not Ruby 2.6.6
19:13
<
havenwood >
JaredCE: That's macOS system Ruby
19:13
<
havenwood >
JaredCE: You just need to have rbenv switch you to 2.6.6
19:14
<
havenwood >
JaredCE: rbenv rehash && rbenv global 2.6.6
19:14
<
havenwood >
JaredCE: Then: gem update --system && bundle
19:15
<
havenwood >
JaredCE: and you should be in good shape
19:15
<
JaredCE >
that doesn't seem to be working
19:15
<
havenwood >
JaredCE: do you have Ruby 2.6.6 from rbenv working yet?
19:15
<
havenwood >
JaredCE: ruby -v
19:16
<
JaredCE >
rbenv global 2.6.6 && ruby -v = ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
19:16
<
havenwood >
JaredCE: Seems rbenv is failing you.
19:16
<
havenwood >
JaredCE: maybe an rbenv user can spot why
19:16
<
havenwood >
JaredCE: is it in your PATH?
19:17
<
havenwood >
JaredCE: I don't use rbenv, but I imagine its shims directory isn't in your PATH.
19:17
<
JaredCE >
yeah think it's missing
19:18
<
havenwood >
JaredCE: Just try running: ~/.rbenv/bin/rbenv init
19:18
<
havenwood >
JaredCE: Once you get rbenv working, everything else should
*just work*
19:18
<
havenwood >
JaredCE: Or RVM and chruby are popular alternatives to rbenv
19:19
<
havenwood >
JaredCE: After an init, do you see 2.6.6 as the `rbenv version` and current Ruby?
19:19
<
JaredCE >
i have an ~/.rbenv/ but no bin in there
19:19
TCZ has joined #ruby
19:20
<
havenwood >
JaredCE: Or if you switch off rbenv I'll know how to help, heh.
19:20
<
havenwood >
It should work if you follow rbenv instructions for macOS.
19:20
<
havenwood >
It's a popular tool on a popular platform so it should have plenty of eyes.
19:22
<
JaredCE >
right that's working now
19:22
<
JaredCE >
thank you so much
19:23
<
adam12 >
JaredCE: Out of curiousity, what’s the output of `dig rubygems.org`
19:32
BSaboia has joined #ruby
19:34
phage has joined #ruby
19:35
<
JaredCE >
i say it worked
19:36
<
JaredCE >
it's still erroring when trying to bundle install
19:37
<
havenwood >
JaredCE: gem install bundler
19:37
<
havenwood >
JaredCE: rbenv rehash
19:37
<
ruby[bot] >
JaredCE: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use
https://gist.github.com
19:38
<
havenwood >
JaredCE: Can you confirm you've updated to the latest RubyGems (gem update --system) and installed Bundler (gem install bundler) then try: bundle
19:38
ur5us__ has joined #ruby
19:38
rubydoc has quit [Remote host closed the connection]
19:39
rubydoc has joined #ruby
19:39
<
JaredCE >
gem update --system does not work
19:40
<
JaredCE >
tbh i have been staring at my screen too long today, gonna clal it a night,
19:40
<
JaredCE >
thanks for your help
19:40
<
havenwood >
JaredCE: Once you get rbenv working everything should fall in line.
19:40
<
havenwood >
JaredCE: Good luck!
19:41
phage has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
19:42
howdoi has joined #ruby
19:45
JaredCE has quit [Ping timeout: 240 seconds]
19:50
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
19:50
MalkbabY_ has joined #ruby
19:52
SeepingN has joined #ruby
19:53
MalkbabY has quit [Ping timeout: 252 seconds]
19:57
crankharder has quit [Ping timeout: 246 seconds]
20:01
SeepingN has quit [Quit: The system is going down for reboot NOW!]
20:01
FastJack has quit [Ping timeout: 240 seconds]
20:05
crankharder has joined #ruby
20:07
prestorium has quit [Ping timeout: 260 seconds]
20:08
FastJack has joined #ruby
20:11
BSaboia has quit [Quit: This computer has gone to sleep]
20:13
prestorium has joined #ruby
20:16
BTRE has quit [Quit: Leaving]
20:16
jla has quit [Ping timeout: 252 seconds]
20:18
BTRE has joined #ruby
20:41
ur5us__ has quit [Ping timeout: 245 seconds]
20:43
wallacer has joined #ruby
20:46
cthu| has quit [Ping timeout: 252 seconds]
20:50
gearnode has quit [Ping timeout: 250 seconds]
20:57
harlin has joined #ruby
20:58
evdubs_ has joined #ruby
20:58
prestorium has quit [Ping timeout: 260 seconds]
21:00
evdubs__ has quit [Ping timeout: 245 seconds]
21:01
anoldhacker has joined #ruby
21:01
evdubs has joined #ruby
21:03
prestorium has joined #ruby
21:03
evdubs_ has quit [Ping timeout: 260 seconds]
21:04
pyra has joined #ruby
21:05
hiroaki has quit [Ping timeout: 260 seconds]
21:06
ruurd has joined #ruby
21:10
<
anoldhacker >
Thanks :)
21:13
hiroaki has joined #ruby
21:14
pyra has quit [Ping timeout: 245 seconds]
21:24
pyra has joined #ruby
21:28
ruurd has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
21:30
zapata has quit [Quit: WeeChat 3.1]
21:31
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
21:33
hiroaki has quit [Ping timeout: 260 seconds]
21:35
CoolerX has quit [Quit: Leaving]
21:35
TCZ has quit [Quit: ...]
21:41
crankharder has quit [Quit: leaving]
21:41
hiroaki has joined #ruby
21:55
ruurd has joined #ruby
21:56
jenrzzz has quit [Ping timeout: 260 seconds]
21:57
py88 has quit [Read error: Connection reset by peer]
21:57
py88 has joined #ruby
21:59
ruurd has quit [Ping timeout: 245 seconds]
22:00
ruby[bot] has quit [Remote host closed the connection]
22:00
ruby[bot] has joined #ruby
22:00
Omnilord has joined #ruby
22:01
dpl__ has joined #ruby
22:04
dpl_ has quit [Ping timeout: 240 seconds]
22:07
jenrzzz has joined #ruby
22:08
Azure has joined #ruby
22:08
Azure has quit [Read error: Connection reset by peer]
22:11
jenrzzz has quit [Ping timeout: 246 seconds]
22:13
<
rinket >
wil u b my fren
22:15
fernando-basso has quit [Quit: May the force]
22:33
gearnode has joined #ruby
22:36
jenrzzz has joined #ruby
22:42
Iarfen has quit [Remote host closed the connection]
22:44
robotbee has quit [Ping timeout: 252 seconds]
22:48
fercell has quit [Read error: Connection reset by peer]
22:51
fercell has joined #ruby
22:51
cuerbot has joined #ruby
22:53
elcuervo has quit [Ping timeout: 246 seconds]
23:04
rogergilmour has joined #ruby
23:06
<
rogergilmour >
hello, any of you know why when I read a json, my file is giving error?
23:06
<
rogergilmour >
@myfile = File.read ("example.json")
23:06
<
rogergilmour >
@result = JSON.parse (@myfile)
23:07
<
weaksauce >
rogergilmour error message?
23:07
<
rogergilmour >
JSON::ParserError at /CRUD_Bricks/
23:07
<
rogergilmour >
767: unexpected token at '[{"name":"roberto","date":"2021-04-28","scala":null}] [{"name":"mario","date":"2021-04-06","scala":null}] [{"name":"ss","date":"2021-04-28","scala":"7"}] '
23:08
jenrzzz has quit [Ping timeout: 252 seconds]
23:08
<
weaksauce >
looks like it's a malformed json
23:10
dpl__ has quit [Quit: dpl__]
23:11
<
rogergilmour >
ok i will test it with another json file
23:13
BSaboia has joined #ruby
23:14
evdubs_ has joined #ruby
23:17
evdubs has quit [Ping timeout: 260 seconds]
23:25
BSaboia has quit [Quit: This computer has gone to sleep]
23:26
jenrzzz has joined #ruby
23:30
jenrzzz has quit [Ping timeout: 252 seconds]
23:34
centrx has joined #ruby
23:39
jobewan has joined #ruby
23:51
centrx_ has joined #ruby
23:54
Omnilord has quit [Quit: Leaving]
23:55
centrx has quit [Ping timeout: 245 seconds]