<linuus[m]>
I guess it's overriden by the `o.method(:method)` method...
tvl has joined #ruby
tvl is now known as tobiasvl
user__ has joined #ruby
<user__>
hi
<user__>
Is it true Ruby is dying ?
vondruch has joined #ruby
<linuus[m]>
Yeah, it's totally dead....
<linuus[m]>
Of course not :)
thomas_25 has quit [Changing host]
thomas_25 has joined #ruby
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
nowhereman has joined #ruby
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<user__>
They claimed that Python ate it.
<linuus[m]>
Haha
sphex has quit [Ping timeout: 265 seconds]
sphex has joined #ruby
user__ has quit [Quit: Leaving]
nowhereman has quit [Ping timeout: 265 seconds]
bitwinery has quit [Quit: Leaving]
ellcs has quit [Ping timeout: 264 seconds]
schne1der has joined #ruby
m_700 has joined #ruby
<m_700>
Hi all, quick questions; Is it possible do define within an rpm spec file something like "gem update --system"? I am building Ruby 2.6.5, and everything works, apart from having to put these rpms on hosts that have no internet access.
sandstrom has joined #ruby
<m_700>
Meaning I can't run the above command. Would it be possible to that before the built Ruby is packaged?
Jonopoly has joined #ruby
matled has quit [Remote host closed the connection]
queip has quit [Ping timeout: 240 seconds]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
queip has joined #ruby
Esa_ has joined #ruby
matled has joined #ruby
chihhsin has quit [Quit: leaving]
xco has joined #ruby
phaul_ has joined #ruby
conta has quit [Ping timeout: 268 seconds]
conta has joined #ruby
jenrzzz has joined #ruby
m_700 has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 240 seconds]
Intelo has quit [Ping timeout: 268 seconds]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
phaul_ has quit [Ping timeout: 264 seconds]
Intelo has joined #ruby
Intelo has quit [Ping timeout: 246 seconds]
Intelo has joined #ruby
phaul_ has joined #ruby
ur5us has joined #ruby
Intelo_ has joined #ruby
ur5us_ has joined #ruby
ur5us_ has quit [Client Quit]
Intelo_ has quit [Read error: Connection reset by peer]
Intelo_ has joined #ruby
Intelo has quit [Ping timeout: 240 seconds]
xco has joined #ruby
ur5us has quit [Ping timeout: 276 seconds]
alfiemax has quit [Remote host closed the connection]
queip has quit [Ping timeout: 268 seconds]
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
nowhereman has joined #ruby
sphinxo has quit [Quit: WeeChat 1.9.1]
queip has joined #ruby
Technodrome has joined #ruby
phaul has quit [Killed (orwell.freenode.net (Nickname regained by services))]
phaul_ is now known as phaul
Guest86961 has joined #ruby
queip has quit [Ping timeout: 268 seconds]
DTZUZO has quit [Ping timeout: 240 seconds]
galaxie_ has quit [Ping timeout: 260 seconds]
queip has joined #ruby
galaxie_ has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<animo8>
I have an interpreter class that interprets source code, but I'd like to implement a curses debugger. Obviously, the debugger has to know about the internals of the interpreter class
<animo8>
What would be the best way to implement such a thing?
dbugger has joined #ruby
<animo8>
I was thinking about a class InterpreterCurses that inherits from Interpreter, so an Interpreter instance only interprets source code while an InterpreterCurses instance also displays a terminal ui
<animo8>
I think it should also be possible to simply use the built in methods for sending messages to bypass encapsulation, but that seems uglier than my inheritance-based solution and will be more cumbersome to write
jenrzzz has joined #ruby
postmodern has quit [Quit: Leaving]
dellavg has joined #ruby
queip has quit [Ping timeout: 240 seconds]
phaul has quit [Ping timeout: 240 seconds]
Intelo_ has quit [Ping timeout: 246 seconds]
jenrzzz has quit [Ping timeout: 250 seconds]
nowhereman has quit [Remote host closed the connection]
AJA4350 has joined #ruby
queip has joined #ruby
nowhereman has joined #ruby
NL3limin4t0r_afk is now known as NL3limin4t0r
<NL3limin4t0r>
linuus[m]: The problem with an attribute `method` is that it's already defined by Object.
<linuus[m]>
NL3limin4t0r: Right, I was just confused that I couldn't use it for OpenStruct. But if I define my own class or even Class.new { ... } it's OK to have a method called `method`.
<NL3limin4t0r>
linuus[m]: You can still access it through: `o[:method]`.
<NL3limin4t0r>
linuus[m]: The reason that's the case is because, OpenStruct redirect each method it doesn't know to the attributes.
<linuus[m]>
NL3limin4t0r: Ah I see. Thanks!
<NL3limin4t0r>
Since ObjectStruct#method is defined you can't use it as accessor for the attributes.
<rubydoc>
stderr: /usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- os... check link for more (https://carc.in/#/r/7zg2)
ur5us has quit [Remote host closed the connection]
nowhereman has quit [Ping timeout: 240 seconds]
Swyper has quit [Read error: Connection reset by peer]
Swyper has joined #ruby
TomyWork has quit [Remote host closed the connection]
Omnilord has quit [Quit: Leaving]
TomyWork has joined #ruby
ur5us has joined #ruby
DTZUZO has joined #ruby
xco has joined #ruby
ur5us has quit [Ping timeout: 245 seconds]
drincruz has quit [Ping timeout: 240 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
phaul has joined #ruby
ur5us has joined #ruby
bsdband50 has quit [Quit: -a- IRC for Android 2.1.55]
bsdbandit-01 has joined #ruby
conta has quit [Ping timeout: 265 seconds]
cow[moo] has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cow[moo] has joined #ruby
AJA4351 has joined #ruby
animo8 has quit [Ping timeout: 264 seconds]
AJA4350 has quit [Ping timeout: 252 seconds]
AJA4351 is now known as AJA4350
Swyper has quit [Remote host closed the connection]
ur5us has quit [Ping timeout: 250 seconds]
Swyper has joined #ruby
lineus_ is now known as lineus
GodFather has quit [Ping timeout: 276 seconds]
dviola has quit [Quit: WeeChat 2.6]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
hyperreal has quit [Quit: kthxbai]
ur5us has joined #ruby
skx86 has quit [Quit: Connection closed for inactivity]
lucasb has joined #ruby
nowhereman has joined #ruby
ur5us has quit [Ping timeout: 264 seconds]
ur5us has joined #ruby
Jonopoly has joined #ruby
Technodrome has joined #ruby
ur5us has quit [Ping timeout: 250 seconds]
bsdband79 has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
bsdbandit-01 has quit [Ping timeout: 245 seconds]
sandstrom has quit [Quit: My computer has gone to sleep.]
aloy has quit [Quit: WeeChat 2.4]
aloy has joined #ruby
ur5us has joined #ruby
aloy has quit [Remote host closed the connection]
aloy has joined #ruby
GodFather has joined #ruby
ur5us has quit [Ping timeout: 250 seconds]
nowhereman has quit [Ping timeout: 268 seconds]
AJA4350 has quit [Ping timeout: 265 seconds]
al2o3-cr has quit [Quit: WeeChat 2.6]
cow[moo] has quit [Ping timeout: 246 seconds]
tpanarch1st_ has joined #ruby
Intelo_ has quit [Quit: Leaving]
Intelo has joined #ruby
al2o3-cr has joined #ruby
tpanarch1st has quit [Ping timeout: 240 seconds]
AJA4350 has joined #ruby
beanie__ has joined #ruby
GodFather has quit [Ping timeout: 268 seconds]
tpanarch1st_ has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
TomyWork has quit [Quit: Leaving]
beanie__ has quit [Quit: Thanks for your help, nice to see you, take care.]
tpanarch1st has joined #ruby
GodFather has joined #ruby
jenrzzz has quit [Ping timeout: 265 seconds]
TomyWork has joined #ruby
nowhereman has joined #ruby
leitz has joined #ruby
AJA4351 has joined #ruby
xco has joined #ruby
jcalla has joined #ruby
AJA4350 has quit [Ping timeout: 264 seconds]
AJA4351 is now known as AJA4350
TomyWork has quit [Quit: Leaving]
gregf_ has joined #ruby
tpanarch1st_ has joined #ruby
tpanarch1st has quit [Ping timeout: 240 seconds]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bkuhlmann has joined #ruby
GodFather has quit [Ping timeout: 240 seconds]
drincruz has joined #ruby
bkuhlmann has quit [Client Quit]
yann-kaelig has quit [Quit: yann-kaelig]
john2496 has joined #ruby
duderonomy has quit [Ping timeout: 268 seconds]
jwr has joined #ruby
john2496 has quit [Client Quit]
lineus has quit [Read error: Connection reset by peer]
AJA4351 has joined #ruby
DTZUZO has quit [Ping timeout: 265 seconds]
duderonomy has joined #ruby
xco has joined #ruby
lineus has joined #ruby
<jwr>
I have a project with a Gemfile, and for a long time `bundle install` worked fine. Recently though, it started erroring out saying `Downloading aws-sdk-resources-3.57.0 revealed dependencies not in the API or the lockfile (aws-sdk-sso (~> 1)). Either installing with `--full-index` or running `bundle update aws-sdk-resources` should fix the problem`. And --full-index does indeed fix the problem. But what causes this? Is it tra
<jwr>
nsient? I suppose I could always use --full-index, but it takes way longer. And for context, this is CI/CD automation, not a developer's laptop.
xco has quit [Client Quit]
AJA4350 has quit [Ping timeout: 268 seconds]
AJA4351 is now known as AJA4350
GodFather has joined #ruby
kyrylo has joined #ruby
xco has joined #ruby
KeyJoo has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Rapture has joined #ruby
sandstrom has joined #ruby
nowhere_man has joined #ruby
AJA4351 has joined #ruby
nowhereman has quit [Ping timeout: 268 seconds]
AJA4350 has quit [Ping timeout: 276 seconds]
AJA4351 is now known as AJA4350
Intelo has quit [Read error: Connection reset by peer]
Intelo has joined #ruby
sandstrom has quit [Ping timeout: 276 seconds]
skryking has joined #ruby
phaul has quit [Ping timeout: 265 seconds]
Intelo has quit [Ping timeout: 240 seconds]
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xco has joined #ruby
rbruchal has joined #ruby
segy has quit [Ping timeout: 265 seconds]
AJA4351 has joined #ruby
nowhere_man has quit [Ping timeout: 265 seconds]
Technodrome has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gregf_ has quit [Remote host closed the connection]
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
segy has joined #ruby
skryking has quit [Quit: Konversation terminated!]
Snowy has joined #ruby
phaul has joined #ruby
Snowy has quit [Read error: Connection reset by peer]
Snowy_ has joined #ruby
Intelo has joined #ruby
Intelo has quit [Ping timeout: 265 seconds]
Swyper_ has joined #ruby
Swyper has quit [Read error: Connection reset by peer]
jenrzzz has joined #ruby
phaul has quit [Ping timeout: 252 seconds]
poontangmessiah has joined #ruby
DTZUZO has joined #ruby
cd has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
AJA4350 has quit [Ping timeout: 252 seconds]
AJA4350 has joined #ruby
etupat has joined #ruby
chalkmonster has joined #ruby
phaul has joined #ruby
etupat has quit [Remote host closed the connection]
etupat has quit [Remote host closed the connection]
sandstrom has joined #ruby
phaul has quit [Ping timeout: 264 seconds]
eljimmy has quit [Ping timeout: 240 seconds]
tpanarch1st_ has quit [Quit: Thanks for your help, nice to see you, take care.]
renich has joined #ruby
sandstrom has quit [Ping timeout: 246 seconds]
Intelo has quit [Remote host closed the connection]
AJA4350 has quit [Ping timeout: 240 seconds]
Intelo has joined #ruby
Snowy_ has quit [Quit: ragequit]
Intelo has quit [Remote host closed the connection]
Intelo has joined #ruby
Jonopoly has quit [Quit: WeeChat 2.5]
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
eljimmy has joined #ruby
etupat has joined #ruby
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
bvdw has quit [Read error: Connection reset by peer]
bvdw has joined #ruby
Guest86675 has joined #ruby
JohanP has quit [Ping timeout: 268 seconds]
cthulchu_ has joined #ruby
poontangmessiah has quit [Remote host closed the connection]
cagomez has joined #ruby
tpanarch1st has joined #ruby
animo8 has joined #ruby
JohanP has joined #ruby
sandstrom has joined #ruby
<havenwood>
jwr: That sounds like a corrupted Gemfile.lock, which can happen when you run into a Bundler bug that subsequently might get fixed but leave behind an error like this.
sandstrom has quit [Ping timeout: 252 seconds]
<havenwood>
jwr: Hopefully, it won't get corrupted again. It's not supposed to happen.
<havenwood>
jwr: --full-index grabs a lot of stuff, and if you don't change your Gemfile often it'll speed up subsequent bundles by having that cache locally. you *shoudln't* need it for the sake of fixing corrupted Gemfile.lock files but in this case you did.
<jwr>
havenwood: my gemfile: https://pastebin.com/xwjFf4sb. FWIW I can reproduce it consistently, each time spinning up a new container and trying to bundle install.
<ruby[bot]>
jwr: 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
<havenwood>
jwr: Do you not have an exiting Gemfile.lock file?
<jwr>
havenwood: when things install correctly it would leave a Gemfile.lock, but today when it errors out of the install it does not leave a Gemfile.lock.
<jwr>
havenwood: also FWIW, the dependency which it's complaining about (aws-sdk-sso) is brand new as of today. I'm kind of wondering if it didn't get populated into rubygems.org's API yet or something.
<havenwood>
jwr: Egad, yeah, I can produce the bug from your Gemfile alone. I'd start an issue with Bundler on GitHub if there isn't one already tracking this.
<havenwood>
jwr: Ah, yeah - that does sound transient then.
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
etupat has quit [Remote host closed the connection]
<yoshie902a>
I’ve noticed that this IRC is not as popular as before, is there a ruby gitter chat forum or another locatoin people are hanging out now?
<havenwood>
yoshie902a: There is a Gitter, but I think it's much busier here.
<yoshie902a>
havenwood: thank you. Hope you are doing well!
<yoshie902a>
havenwood: and thank you for all your past help!
<havenwood>
yoshie902a: Too busy, but otherwise great! Freyja's Day!
<havenwood>
yoshie902a: No prob. Happy to look at your SO after this meeting.
<yoshie902a>
thank you
_dbugger has joined #ruby
wildtrees has joined #ruby
etupat has joined #ruby
lineus has quit [Ping timeout: 264 seconds]
dbugger has quit [Ping timeout: 245 seconds]
cloaked1 has joined #ruby
chalkmonster has quit [Quit: WeeChat 2.6]
lineus has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
etupat has quit [Remote host closed the connection]
cagomez has quit [Remote host closed the connection]
cagomez has joined #ruby
bsdbandit-01 has joined #ruby
bsdband79 has quit [Ping timeout: 250 seconds]
sandstrom has joined #ruby
rkoller has joined #ruby
Guest86675 has joined #ruby
cagomez has quit [Ping timeout: 268 seconds]
cagomez has joined #ruby
ravenousmoose has joined #ruby
Guest86675 has quit [Ping timeout: 240 seconds]
<havenwood>
yoshie902a: Looks like you can just put your #title_with_if_statement if statement in the #enforce_policy_to_level method.
suukim has quit [Ping timeout: 268 seconds]
<yoshie902a>
how would that work? at the content is calculated/processed after
woodruffw has quit [Ping timeout: 240 seconds]
ravenousmoose has quit [Ping timeout: 276 seconds]
<yoshie902a>
havenwood: my issue is that I would like to improve readabilty, and so having the enforce_policy method at the top does that. Since the enforce_policy uses the results of title, it makes it a bit harder.
<yoshie902a>
havenwood: After playing with the code, a bunch, I think this might be ok…https://pastebin.com/aJvN0Ln6
<ruby[bot]>
yoshie902a: 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
woodruffw has joined #ruby
woodruffw has joined #ruby
woodruffw has quit [Changing host]
skx86 has joined #ruby
davidw has joined #ruby
sauvin has quit [Remote host closed the connection]
<yoshie902a>
havenwood: can you think of a better way to do something like this?
<davidw>
Anyone know offhand how to look at the results of expect { ...something.... } ?
<davidw>
passing a block in other words
AJA4351 has joined #ruby
<yoshie902a>
davidw: do you have a specific example? block.call
<yoshie902a>
davidw: it all depends what you mean and where it is used
AJA4350 has quit [Ping timeout: 246 seconds]
AJA4351 is now known as AJA4350
woodruffw has quit [Ping timeout: 240 seconds]
<yoshie902a>
davidw: yield is the rsesult of a block
<yoshie902a>
davidw: does any of this help?
bsdband45 has joined #ruby
<davidw>
yoshie902a, not really. expect { MyService.call }}.to(change { Subscription.count.by(1) }) is the example. I'd also like to check what it returns
woodruffw has joined #ruby
woodruffw has quit [Changing host]
woodruffw has joined #ruby
<yoshie902a>
davidw: in the context of rspec. got it. just look at MyService.call
<yoshie902a>
oh, hold on.
<davidw>
ah yeah..rspec...oops...left that out :-/
<adam12>
davidw: You might just have to add another expect.
<yoshie902a>
looks like you have custom helpers
bsdbandit-01 has quit [Ping timeout: 246 seconds]
<davidw>
this is in Rails, so that may have tacked on a few
<yoshie902a>
you have to look at what the helpers are doing or the MyService.call is doing for you and manually check what it does
<yoshie902a>
I would binding.pry the .call in MyService and test through each step
<havenwood>
yoshie902a: do you need to have code go before *and* after the #enforce_policy_to_level or is it fair to include everything i the method up to the return value inside it?
<havenwood>
dunno if my question makes sense? doesn't to me when I reread it. >.>
<havenwood>
yoshie902a: like, do you want this to be a before action?
<havenwood>
yoshie902a: or might there be code you need to run before the #enforce_policy_to_level check in the method.
<yoshie902a>
havenwood: no code before had
<yoshie902a>
before hand
<yoshie902a>
just after
<Xeago>
havenwood: mind if I suggest (with attribution) my students to look at your idempotency episode on the sandbox show?
<havenwood>
Xeago: Please do! :D
<Xeago>
<3
woodruffw has quit [Ping timeout: 240 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
<yoshie902a>
davidw: ^ sorry I forgot to tag you in my response
greengriminal has joined #ruby
<yoshie902a>
davidw: you can chain multiple expectations with `.and` or eve ‘.or’
DTZUZO has quit [Ping timeout: 240 seconds]
greengriminal has quit [Client Quit]
eljimmy has joined #ruby
<davidw>
yoshie902a, yeah, .and(be(1)), but that errors out: You must pass an argument rather than a block to `expect` to use the provided matcher (change
<davidw>
kind of backwards though because it actually uses a block and the error goes away when I remove .and(be(1))
queip has quit [Ping timeout: 240 seconds]
<yoshie902a>
try to .eql(‘valiue’).and change {Subscription.count}.by(1)
Intelo has quit [Remote host closed the connection]
Intelo has joined #ruby
woodruffw has joined #ruby
woodruffw has quit [Changing host]
woodruffw has joined #ruby
<yoshie902a>
davidw: ^
<davidw>
order shouldn't matter, but I'll give it a try
shirak has joined #ruby
<davidw>
yeah, doesn't work...
<yoshie902a>
:(
<davidw>
it's mixing and matching match types
<davidw>
but ... if you can match on raise_error or something, there ought to be one to match on returns_result or something :-/
<yoshie902a>
davidw: I would just write two seperate tests, I would not try to over complicate it
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
Fernando-Basso has quit [Remote host closed the connection]
queip has joined #ruby
Fernando-Basso has joined #ruby
tricon has quit [Ping timeout: 240 seconds]
tricon has joined #ruby
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<yoshie902a>
havenwood: ideal would be a before action for all my fields, with the abilty to add an exception of a few fields that do not need it
<yoshie902a>
(fields = methods) as this is for a presenter
DTZUZO has joined #ruby
eljimmy has quit [Remote host closed the connection]
<yoshie902a>
If I duplicate every method with a modified name, then I could reference it, but that’s not ideal, and it’s very messy
hiroaki has joined #ruby
<bougyman>
11/08-14:37 < yoshie902a> [20:10:53] davidw: I would just write two seperate tests, I would not try to over complicate it
<bougyman>
uh
jenrzzz has joined #ruby
<yoshie902a>
bougyman: chaining multiple expectations with a change event was failing, so it seemed easer to rewrite two seperate rspec tests. Any ideas to allow davidw to chain expectations?
woodruffw has quit [Ping timeout: 246 seconds]
woodruffw has joined #ruby
woodruffw has quit [Changing host]
woodruffw has joined #ruby
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 245 seconds]
AJA4351 is now known as AJA4350
jenrzzz has quit [Ping timeout: 268 seconds]
bsdbandit-01 has joined #ruby
bsdband45 has quit [Ping timeout: 265 seconds]
dinfuehr has quit [Ping timeout: 265 seconds]
jenrzzz has joined #ruby
dinfuehr has joined #ruby
woodruffw has quit [Ping timeout: 240 seconds]
poontangmessiah_ has joined #ruby
shirak has quit [Ping timeout: 265 seconds]
poontangmessiah has quit [Ping timeout: 264 seconds]
AJA4351 has joined #ruby
AJA4350 has quit [Ping timeout: 250 seconds]
AJA4351 is now known as AJA4350
woodruffw has joined #ruby
woodruffw has quit [Changing host]
woodruffw has joined #ruby
Xiti has quit [Quit: Xiti]
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz has joined #ruby
Nicmavr has quit [Ping timeout: 245 seconds]
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
woodruffw has quit [Ping timeout: 240 seconds]
woodruffw has joined #ruby
woodruffw has quit [Changing host]
woodruffw has joined #ruby
animo8 has joined #ruby
<yoshie902a>
havenwood: I think I have solution. thank you again! I modified that before method from stackoverflow and passing a block to with content.
<havenwood>
yoshie902a: I haven't had a chance to try, but I'm nerd sniped. I'll attempt after work. :)
<yoshie902a>
I would love to see your solution when you do, THANK YOU!
Nicmavr has joined #ruby
AJA4351 has joined #ruby
dellavg has quit [Ping timeout: 268 seconds]
ravenousmoose has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
AJA4350 has quit [Ping timeout: 240 seconds]
AJA4351 is now known as AJA4350
rbruchal has quit [Ping timeout: 245 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
akemhp has joined #ruby
jenrzzz has joined #ruby
AJA4351 has joined #ruby
<NL3limin4t0r>
yoshie902a: regarding your SO question, you might be able to write a module for that
etupat has quit [Remote host closed the connection]
Eiam has joined #ruby
Xiti has joined #ruby
dinfuehr has joined #ruby
<Guest4960>
I have an old machine and typically find that Ruby's performance is sub-optimal. Is there a fastest implementation? Primarily need it to drive a Rails app.
<NL3limin4t0r>
yoshie902a: Note that both #current_user_level and #secure must be available on the class and should not be wrapped in a policy level. Otherwise when trying to get the #current_user_level it needs to check the policies, for which #current_user_level is needed, landing you in an infinit loop.
<yoshie902a>
NL3limin4t0r: I’m trying to follow the code, but a bit lost.
<yoshie902a>
what do you mean by newly defined methods? methods that are not set to a policy level?
gix has joined #ruby
Guest4960 is now known as komment-io
<NL3limin4t0r>
yoshie902a: No, I mean methods that have yet to be defined.
<yoshie902a>
does the placement of policy_level matter in the class? or are you just passing the method names in policy level to set thier policy?
woodruffw has quit [Ping timeout: 276 seconds]
<NL3limin4t0r>
yoshie902a: I'm using the Module::method_added callback to wrap those new methods inside a wrapper. Which uses the current policy_level set.
<jwr>
havenwood: not that you were necessarily waiting in suspense, but i just ran our automation again and it now installed that aws-sdk-sso gem just fine. seems like rubygems.org must've rebuilt a cache or something because it's fine now.
<NL3limin4t0r>
yoshie902a: The placement matters, it works similar to the `public`, `protected` and `private` methods.
<NL3limin4t0r>
aka all methods defined after `private` are private
jwr has quit [Remote host closed the connection]
<yoshie902a>
in your example, brand method is above policy level 3, but you still set the level by passing the method name. So from what I understand, if you put policy_level3 about brand, it would also work
<NL3limin4t0r>
so all methods defined after you set a policy level will use that policy level. Until you change policy levels again, methods after that will use the new policy level.
<yoshie902a>
So much cleaner then what I was going to do
hiroaki has joined #ruby
komment-io has left #ruby [#ruby]
xco has joined #ruby
<NL3limin4t0r>
yoshie902a: I've taken inspiration from the method visibility modifiers. if you do `private :method_name` only that one method will be set to private and it will not effect the current visibility level.
<yoshie902a>
NL3limin4t0r: I’m impressed!
<yoshie902a>
It’s going to take me a while to understand exactly how you did everything, but I am starting to understand. The key seems to be the method_added method, which is a callback
<NL3limin4t0r>
Similarly the first method (#brand) doesn't have an access level when defined (because you haven't set a policy level) and you explicitly give it an access level afterwards. The next method #manifacturer also doesn't have a policy level, since there is still no policy level set. After that you set the policy level for new methods and define the #title method, making the policy level of #title equal to 2.
<yoshie902a>
and to clear the policy level, you set it to nil
<NL3limin4t0r>
yep
Nicmavr has quit [Ping timeout: 245 seconds]
AJA4351 has joined #ruby
<NL3limin4t0r>
The class extending the class should have both #current_user_level and #secure withour methods without policies appied to them to prevent an infinit loop.
AJA4350 has quit [Ping timeout: 265 seconds]
AJA4351 is now known as AJA4350
codeasone has quit [Quit: Connection closed for inactivity]
<NL3limin4t0r>
You can obviously change the whole thing to fit your behaviour.
<yoshie902a>
This is what I wanted to do initially, but gave up
<NL3limin4t0r>
The reason I use MethodWrapper is to not clutter extending class too mutch.
<yoshie902a>
I had no idea the method_added was available
<yoshie902a>
that makes sense
<NL3limin4t0r>
Otherwise things like the #wrap helper and the @wrapping variable would be available (and overidable) on the Car class.
ellcs has quit [Ping timeout: 245 seconds]
chalkmonster has joined #ruby
<yoshie902a>
how would it handle ‘ delegate_missing_to :@object’
chalkmonster has quit [Client Quit]
<yoshie902a>
Since it’s not a new method, I assume it has no effect on it
banisterfiend has joined #ruby
Nicmavr has joined #ruby
lxsameer has quit [Ping timeout: 245 seconds]
<yoshie902a>
how does this work when classes are inherited?
animo8 has quit [K-Lined]
Nicmavr has quit [Ping timeout: 245 seconds]
<NL3limin4t0r>
That's a tricky one, if it doesn't already work (since #delegate_missing_to does define methods, but doesn't add new once) you could do `policy_level 3, :method_missing` and it should use policy level 3 for all methods it's forwarding.
<yoshie902a>
NL3limin4t0r: :)
<NL3limin4t0r>
yoshie902a: If you inherit from another class that doesn't use policies, you can apply them by simply stating: policy_level 3, :method1, :method2, :method3 to apply policies to the inherited methods.
lineus has quit [Read error: Connection reset by peer]
lineus has joined #ruby
<NL3limin4t0r>
If you do inherit from a class that uses policies, they are inhertied. So inherting from Car will inherit thos methods with their policies.'
xco has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<yoshie902a>
perfect, just like private
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
drincruz has quit [Ping timeout: 240 seconds]
AJA4351 has joined #ruby
banisterfiend has joined #ruby
hiroaki has quit [Ping timeout: 252 seconds]
<yoshie902a>
NL3limin4t0r: Thank you, heading home to see the kids for dinner
sandstrom has quit [Ping timeout: 246 seconds]
<yoshie902a>
havenwood: Thankyou too!
yoshie902a has left #ruby [#ruby]
<NL3limin4t0r>
yoshie902a: I'll add some comments in the gist for clarity