
Product
Unify Your Security Stack with Socket Basics
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.
Decorator style assertions and type check library for Contract programming
This gem is still in development and it isnt available to production.
Add this line to your application's Gemfile:
gem 'moguro'
And then execute:
$ bundle
Or install it yourself as:
$ gem install moguro
require 'moguro'
class MockClass
include Moguro::Decorator
# Must match argument names of decorate method
pre_c ->(a: Integer, b: String) {
assert_equal(a, 1)
assert_equal(b, 'b')
}
def puts_method(a, b)
puts b
a + 1
end
# Return values are auto assigned in order
post_c -> (first: String) {
p first
}
def post_contract_violation_method
1
end
end
c = MockClass.new
c.puts_method(1, 'b')
# 1
# => 2
begin
c.puts_method('a', 1)
rescue => e
p e
end
# =>
# Type MissMatch: a is expected (Integer) actual a(String) (Moguro::Errors::ArgumentsTypeMismatchError)
# Expected: [a: (Integer), b: (String)]
# Actual: [a: a(String), b: 1(Integer)]
# Value guarded in: MockClass::puts_method
# At: #{source_location}
begin
c.post_contract_violation_method
rescue => e
p e
end
# =>
# Type MissMatch: first is expected (String) actual 1(Integer)
# Expected: [first: (String)]
# Actual: [first: 1(Integer)]
# Value guarded in: MockClass::post_contract_violation_method
# At: #{source_location}
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Moguro project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that moguro 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.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.
Product
Socket is launching experimental protection for the Hugging Face ecosystem, scanning for malware and malicious payload injections inside model files to prevent silent AI supply chain attacks.
Research
/Security News
The Socket Threat Research Team uncovered a coordinated campaign that floods the Chrome Web Store with 131 rebranded clones of a WhatsApp Web automation extension to spam Brazilian users.