00:09
dviola has quit [Ping timeout: 256 seconds]
00:21
roadie has joined #ruby
00:25
roshanavand_ has joined #ruby
00:26
roadie has quit [Ping timeout: 268 seconds]
00:27
ur5us_ has joined #ruby
00:28
roshanavand has quit [Ping timeout: 252 seconds]
00:31
roshanavand__ has joined #ruby
00:34
roshanavand_ has quit [Ping timeout: 256 seconds]
00:37
roadie has joined #ruby
00:44
roadie has quit [Ping timeout: 268 seconds]
00:54
swaggboi has joined #ruby
00:58
michigan has quit [Quit: Connection closed for inactivity]
01:09
Pipip has joined #ruby
01:17
roshanavand__ has quit [Ping timeout: 240 seconds]
01:22
ur5us_ has quit [Ping timeout: 240 seconds]
01:45
roadie has joined #ruby
01:49
hololeap_ has joined #ruby
01:49
hololeap has quit [Read error: Connection reset by peer]
01:50
Rounin has quit [Ping timeout: 245 seconds]
01:52
roadie has quit [Ping timeout: 268 seconds]
01:57
lim has quit [Quit: WeeChat 3.2.1]
02:08
<
libsys >
hello people... question, how could I execute a lambda within an specific context? I'm trying to allow lambdas/procs that can use methods from an specific class, but defining these lambdas outside of the class instance
02:10
<
libsys >
e.g: class MyClass; def mymethod; 'helo' end; end ... my_obj = MyClass.new; my_obj.lambda { "#{mymethod} world" }
02:12
<
havenwood >
libsys: my_obj.class_eval { puts mymethod }
02:13
<
havenwood >
I mean instance_eval.
02:13
<
havenwood >
my_obj.instance_eval { puts mymethod }
02:13
<
havenwood >
or: my_obj.then { |obj| obj.mymethod }
02:14
<
libsys >
I need it to be a lambda because it's defined through configuration... probably I could simply execute the lambda within instance_eval?
02:15
<
libsys >
would that recognize the scope?
02:16
<
havenwood >
libsys: my_obj.instance_eval { ->{ mymethod } }.call #=> "hell"
02:17
<
havenwood >
libsys: try in irb
02:21
orbyt_v10 has joined #ruby
02:22
<
libsys >
says "undefined local variable or method `my_method' for main:Object" because lambda binds the scope where it's been defined
02:22
<
libsys >
is there a way to alter the scope of a function/proc/lambda?
02:24
<
libsys >
I could make a trick to pass the instance of my_obj into the lambda through a parameter though... probably that's my best bet :/
02:41
finstern1s is now known as finsternis
02:46
roshanavand__ has joined #ruby
02:47
roadie has joined #ruby
02:49
aindilis has joined #ruby
02:52
finsternis has quit [Quit: leaving]
02:52
roadie has quit [Ping timeout: 240 seconds]
02:52
finsternis has joined #ruby
02:57
jhass has quit [Ping timeout: 240 seconds]
03:01
niv has joined #ruby
03:13
roadie has joined #ruby
03:15
<
havenwood >
libsys: I meant: my_obj.instance_eval { my_lambda = -> { "#{my_method} world" } }
03:15
<
havenwood >
libsys: my_lambda.call
03:16
<
havenwood >
libsys: alternatively you can pass a binding to a lambda
03:17
roadie has quit [Ping timeout: 240 seconds]
03:18
<
Pipip >
So is BasicObject an Object?
03:19
<
havenwood >
Pipip: Yes.
03:19
<
Pipip >
What does that mean?
03:21
<
Pipip >
So BasicObject is the class of Object
03:21
<
Pipip >
*superclass
03:22
<
havenwood >
Pipip: Yeah, Object.superclass #=> Basic_object
03:22
<
havenwood >
BasicObject.superclass #=> nil
03:27
<
havenwood >
BasicObject.instance_of? Class #=> true
03:30
<
havenwood >
Class.superclass #=> Module
03:30
<
havenwood >
Module.superclass #=> Object
03:30
<
havenwood >
Object.superclass #=> BasicObject
03:40
hololeap_ is now known as hololeap
03:42
roshanavand_ has joined #ruby
03:45
roshanavand__ has quit [Ping timeout: 256 seconds]
03:48
shiru has joined #ruby
03:53
easbarba` has joined #ruby
03:54
BSaboia has quit [Quit: This computer has gone to sleep]
03:55
easbarba has quit [Ping timeout: 268 seconds]
04:01
FetidToot has joined #ruby
04:10
roshanavand_ has quit [Ping timeout: 240 seconds]
04:16
BSaboia has joined #ruby
04:16
orbyt_v10 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
04:26
Guest4525 has joined #ruby
04:27
Guest4525 has quit [Client Quit]
04:34
orbyt_v10 has joined #ruby
04:34
reset has quit [Quit: reset]
04:34
BSaboia has quit [Quit: This computer has gone to sleep]
04:35
gr33n7007h has joined #ruby
04:35
reset has joined #ruby
04:39
BSaboia has joined #ruby
04:58
huma has joined #ruby
04:59
jimeh has quit [Remote host closed the connection]
04:59
jimeh has joined #ruby
05:03
sagax has joined #ruby
05:13
roadie has joined #ruby
05:18
roadie has quit [Ping timeout: 252 seconds]
05:33
shiru has quit [Quit: leaving]
05:49
<
Pipip >
That makes sense
05:51
roadie has joined #ruby
06:08
hololeap has quit [Remote host closed the connection]
06:09
hololeap has joined #ruby
06:14
huma has quit [Ping timeout: 240 seconds]
06:22
BSaboia has quit [Quit: This computer has gone to sleep]
07:14
orbyt_v10 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
07:18
_ht has joined #ruby
07:22
Pipip has quit [Quit: Ex-Chat]
07:31
huma has joined #ruby
07:43
roadie has quit [Ping timeout: 268 seconds]
07:55
roadie has joined #ruby
07:55
jhass has joined #ruby
07:58
michigan has joined #ruby
08:16
Rounin has joined #ruby
08:31
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
09:00
BSaboia has joined #ruby
09:02
BSaboia has quit [Read error: Connection reset by peer]
09:23
huma has quit [Ping timeout: 240 seconds]
09:32
perrierjouet has joined #ruby
09:45
perrierjouet has left #ruby [WeeChat 3.3]
10:01
BSaboia has joined #ruby
10:04
BSaboia has quit [Client Quit]
10:33
nucranium has quit [Quit: Konversation terminated!]
10:43
BSaboia has joined #ruby
10:58
<
nakilon >
wait so BasicObject is a class and an instance?
10:59
dka_ has quit [Quit: My Ex-Girlfriend once told me: I'm not a slut, I'm just popular]
11:01
dka has joined #ruby
11:14
BSaboia has quit [Quit: This computer has gone to sleep]
11:16
BSaboia has joined #ruby
11:19
BSaboia has quit [Client Quit]
11:29
<
nakilon >
Class.class => Class _<>
11:45
phryk has joined #ruby
11:45
<
ccooke >
nakilon: Everything in Ruby is an instance of a class. So BasicObject is an instance of class Class.
11:47
BSaboia has joined #ruby
11:55
BSaboia has quit [Quit: This computer has gone to sleep]
11:57
BSaboia has joined #ruby
12:18
FetidToot has quit [Ping timeout: 240 seconds]
12:21
fef has joined #ruby
12:22
yxhuvud has quit [Quit: No Ping reply in 180 seconds.]
12:23
yxhuvud has joined #ruby
12:27
BSaboia has quit [Quit: This computer has gone to sleep]
12:29
FetidToot has joined #ruby
12:29
BSaboia has joined #ruby
12:32
vigumnov has joined #ruby
12:32
victori has quit [Read error: Connection reset by peer]
12:44
lim has joined #ruby
12:54
lim has quit [Quit: WeeChat 3.2.1]
13:36
tkonto has joined #ruby
13:38
michigan has quit [Quit: Connection closed for inactivity]
13:41
michigan has joined #ruby
14:00
teclator has quit [Ping timeout: 268 seconds]
14:00
gr33n7007h has quit [Quit: WeeChat 3.4]
14:03
teclator has joined #ruby
14:06
tkonto has quit [Quit: tkonto]
14:24
Tempesta has quit [Quit: See ya!]
14:26
robotmay has quit [Quit: No Ping reply in 180 seconds.]
14:27
robotmay has joined #ruby
14:29
Tempesta has joined #ruby
14:50
BSaboia has quit [Quit: Leaving]
15:18
huma has joined #ruby
15:50
sylario has joined #ruby
15:52
<
sylario >
How do you call the method call a class make when it's instanciated ? like has_many or validate
15:52
<
sylario >
What's the patten/metaprograming name for it?
17:11
huma has quit [Ping timeout: 240 seconds]
17:27
<
adam12 >
sylario: class methods?
17:30
<
sylario >
yeah but it does not really convey the "designed to be call at class instanciation" part.
17:31
<
sylario >
Maybe DSL
18:53
fef has quit [Ping timeout: 276 seconds]
19:19
___nick___ has joined #ruby
19:29
Al2O3 has quit [Ping timeout: 240 seconds]
19:34
gr33n7007h has joined #ruby
19:55
lim has joined #ruby
19:55
swaggboi has quit [Ping timeout: 268 seconds]
19:57
Al2O3 has joined #ruby
19:58
lim has quit [Remote host closed the connection]
20:04
lim has joined #ruby
20:13
ur5us_ has joined #ruby
20:20
Cork has quit [Ping timeout: 256 seconds]
20:29
lim has quit [Ping timeout: 256 seconds]
20:30
___nick___ has joined #ruby
20:30
___nick___ has quit [Client Quit]
20:32
___nick___ has joined #ruby
21:04
___nick___ has quit [Ping timeout: 240 seconds]
21:11
_ht has quit [Remote host closed the connection]
21:14
<
havenwood >
sylario: I think you mean at runtime rather than on class instanciation?
21:14
<
havenwood >
Class instantiation is like Foo.new.
21:17
<
havenwood >
You can do the same yourself. See Rails concerns for Rails-specific concerns.
21:19
<
sylario >
Yes technically, I get it's a class method, but on a conceptual level 'class method called at the root of a class' are not the same than SomeService.call().
21:20
<
sylario >
I am a bit surprised there is no word to designate them
21:45
<
havenwood >
sylario: Yeah, at top level inside a class the receiver is self, so while they're still just class methods you can drop the explicit receiver.
21:46
<
havenwood >
`class Foo; has_many end` is the same as `class Foo; self.has_many end` which is the same as `class Foo; Foo.has_many end`
21:47
<
havenwood >
sylario: Similarly in an instance of a class you can do implicit self with instance methods. There's not a special name since it's really not a particularly special case.
21:47
<
havenwood >
They're just plain 'ole class methods referenced inside the class at top level.
21:48
<
havenwood >
You can write it Foo.has_many for an explicit version.
22:08
hololeap has quit [Excess Flood]
22:11
hololeap has joined #ruby
22:16
Cork has joined #ruby
22:45
Rounin has quit [Ping timeout: 268 seconds]
23:01
samgranieri has joined #ruby
23:06
<
sagax >
on page of `gem server` i see some errors about `stylesheet 404, javascript 404` - how fix `gem server` for read rdoc?
23:15
Cork has quit [Ping timeout: 256 seconds]
23:33
<
havenwood >
sagax: I've not seen 404s with gem server before. Share a gist with the full error?