Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
= safer
== DESCRIPTION:
Safer is an umbrella library, with components designed to make it simple to verify and improve the safety of your ruby code. There are at present three modules under the safer umbrella:
[Safer::IVar] generates specially-named accessor functions for class instance variables. [Safer::Protocol] is used to provide a ruby analogue to Objective-C Protocols (which are similar to Java interfaces, but do not require inheritance). [Safer::HashProtocol] verifies that a Hash keys follow a defined format. Intended to help use of Hash objects as keyword parameters.
== FEATURES/PROBLEMS:
== SYNOPSIS:
require 'safer/ivar' require 'safer/protocol' require 'safer/hashprotocol'
module MyModule class MyProtocolClass def self.class_method_foo(arg1, arg2) end def instance_method(arg3) end end PROTOCOL = Safer::Protocol.create_from_class(MyProtocolClass) class MyClass Safer::IVar.instance_variable(self, :var1, :var2) def initialize(var1, var2) PROTOCOL.instance_conforms?(var1) PROTOCOL.instance_conforms?(var2) self.mymodule_myclass__var1 = var1 self.mymodule_myclass__var2 = var2 end
SHP = Safer::HashProtocol
V1Keywords = SHP::HasKey.create(:name, :type)
V2Keywords = SHP::HasKey.create(:first, :last, :type)
V1Check = SHP::Only.new(SHP::Any.new(*V1Keywords))
V2Check = SHP::Only.new(SHP::Any.new(*V2Keywords))
ValidCheck = SHP::Any.new(V1Check, V2Check)
def my_fn(h)
if ! (ValidCheck === h)
raise ArgumentError, "h should conform to #{ValidCheck.description}"
end
case h
when V1Check
v1_process(h[:name], h[:type])
when V2Check
v2_process(h[:first], h[:last], h[:type])
end
end
end
end
== REQUIREMENTS:
== INSTALL:
== DEVELOPERS:
After checking out the source, run:
$ rake newb
This task will install any missing dependencies, run the tests/specs, and generate the RDoc.
== LICENSE:
This software is placed into the public domain.
FAQs
Unknown package
We found that safer 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.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.