Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
This is simple decorator for Ruby.
Kumadori mean make-up for Japanese Kabuki.
Add this line to your application's Gemfile:
gem 'kumadori'
And then execute:
$ bundle
Or install it yourself as:
$ gem install kumadori
Kumadori decorate your instance by #{instance.class}Decorator class.
#
# Basic ruby class.
#
class User
attr_accesstor :first_name, :last_name
def initialize(first_name, last_name)
self.first_name = first_name
self.last_name = last_name
end
end
#
# Decorator class for User instance.
#
class UserDecorator < Kumadori::BaseDecorator
def full_name
"#{self.last_name} #{self.first_name}"
end
end
user = User.new('Yuji', 'Arakaki')
# user instance decorated by UserDecorator
decorated_user = Kumadori.decorate(user)
decorated_user.full_name # => "Arakaki Yuji"
if you not defined #{instance.class}Decorator class, it's instance decorated by Kumadori::BaseDecorator. So, if you want defined method for every instance, you just override Kumadori::BaseDecorator, and defined method.
class Animal
end
module Kumadori
class BaseDecorator < ::SimpleDelegator
def live?
true
end
end
end
animal = Animal.new
# Because of AnimalDecorator class is not defiend,
# it is decorated by Kumadori::BaseDecorator
decorated_animal = Kumadori.decorate(animal)
decorated_animal.live? # => true
if you want to decorate all items in collection, use Kumadori.collection_decorate method.
members = []
members << User.new('Kanoko', 'Higa')
members << User.new('Ai', 'Kawasaki')
members << User.new('Takeo', 'Kikuchi')
decorated_members = Kumadori.collection_decorate(members)
decorated_members.map{ |user| user.full_name} # => ["Higa Kanoko", "Kawasaki Ai", "Kikuchi Takeo"]
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that kumadori 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.