
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
= Method Decorator
{}[https://travis-ci.org/r4z3c/method_decorator]
{
}[https://codeclimate.com/github/r4z3c/method_decorator]
{
}[https://codeclimate.com/github/r4z3c/method_decorator/coverage]
{
}[https://codeclimate.com/github/r4z3c/method_decorator]
Provides a way to dynamically override methods without losing original behavior.
== Example
For a given class:
class SomeClass
def some_method(some_arg)
puts some_arg
end
end
MethodDecorator.decorate SomeClass, :some_method do
puts "decorated_some_method_with: #{call_args}"
call_original
end
This call:
SomeClass.new.some_method 'some arg'
Produces this output:
decorated_some_method_with: ["some arg"]
some arg
== Helper Methods
Inside the block given to MethodDecorator.decorate
, you can call four helper methods:
call_args # returns original arguments given to the call
call_block # returns original block given to the call
call_original # call the original method, with original args and block given to the call
call_original_with # call the original method, with desired args and block
== Module inclusion
You can call decorate
method directly instead of calling MethodDecorator.decorate
. Just include MethodDecorator
module:
class SomeClass
def some_method(some_arg)
puts some_arg
end
include MethodDecorator
decorate :some_method do
puts "decorated_some_method_with: #{call_args}"
call_original
end
end
== Singleton Classes Support
It works too:
class SomeClass
class << self
def some_method(some_arg)
puts some_arg
end
end
end
MethodDecorator.decorate SomeClass.singleton_class, :some_method do
puts "decorated_some_method_with: #{call_args}"
call_original
end
SomeClass.some_method 'some arg'
== More
To see more of MethodDecorator
usages, please take a look at DummyClass[https://github.com/r4z3c/method_decorator/blob/master/spec/support/dummy_class.rb].
===
{}[https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=AMPXM3PW6CTBE]
FAQs
Unknown package
We found that method_decorator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.