tap + instance_eval
urirequire hijacks Kernel.require to download and eval Ruby code somewhere else on the internets.
* http://rubysideshow.rubyforge.org/irb_callbacks == DESCRIPTION: This gem adds callbacks to irb, intended for you to override at your discretion. == FEATURES: irb's control flow looks like this: loop: * prompt * eval * output This gem adds three callbacks to each phase. module IRB: * self.before_prompt * self.around_prompt (call yield) * self.after_prompt * self.before_eval * self.around_eval (call yield) * self.after_eval * self.before_output * self.around_output (call yield) * self.after_output == SYNOPSIS: # Here's my ~/.irbrc file (which is run at irb startup) require 'rubygems' require 'irb_callbacks' require 'benchmark' # This little snippet will time each command run via the console. module IRB def self.around_eval(&block) @timing = Benchmark.realtime do block.call end end def self.after_output puts "=> #{'%.3f' % @timing} seconds" end end # And a sample irb session: $ irb irb(main):001:0> 1_000_000.times { |x| x + 1 } => 1000000 => 0.330 seconds == CAVEATS: The three around_* callbacks all require you to call the block that's passed in. If you don't do it, undefined behavior may occur. == INSTALL: * sudo gem install irb_callbacks == LICENSE: (The MIT License) Copyright (c) 2008 Mike Judge Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Lightweight gem for document retrieval using tf-idf based algorithms for Ruby
A secure, non-evaling end user template engine with aesthetic markup.
Convert series of chained methods from . syntax to block syntax. Like instance_eval but with access to external scope.
Square Cube evaluator gem
I sometimes get a little descriptive with my variable names, so when you're doing a lot of work specifically with one object, it gets especially ugly and repetetive, making the code harder to read than it needs to be: @contract_participants_on_drugs.contract_id = params[:contract_id] @contract_participants_on_drugs.participant_name = params[:participant_name] @contract_participants_on_drugs.drug_conviction = DrugConvictions.find(:wtf => 'this is getting ridiculous') ... And so on. It gets ridiculous. Utility Belt implements a with(object) method via a change to Object: class Object #utility belt implementation def with(object, &block) object.instance_eval &block end end Unfortunately, that just executes the block in the context of the object, so there isn't any crossover, nor can you perform assignments with attr_accessors (that I was able to do, anyway). So, here's With.object() to fill the void. With.object(@foo) do a = "wtf" b = "this is not as bad" end In the above example, @foo.a and @foo.b are the variables getting set. If you prefer, you can require 'with_on_object' instead and use the notation with(object) do ... end. The tests in the /test directory offer more examples of what's been implemented and tested so far (except where noted - namely performing assignment to a variable that was declared outside the block, and is not on @foo). Not everything is working yet, but it works for the simplest, most common cases I've run up against. More complex tests are on the way, along with code to make them pass. Special thanks to Reg Braithwaite, for help and ideas along the way.
Searchlogic makes using ActiveRecord named scopes easier and less repetitive. (lazy polymorphic eval)
demisyn; methods without punctuation. Refinement for punctuationless eval.
EVAL Lua scripts in Redis by name
Allow to store ActiveModel validations in ORM.
Gema para acceder al servicio de evaluación de promociones
library to save away eval'ed code to a file first, so that it can be seen later [ex: while debugging]
## Why I have to develop this tool One of my ruby project is using bundler to manage gem dependencies. But the `Gemfile` is very complicate. It requires external `Gemfile` by using ruby `eval`. Because I have lots of similar projects that will use same piece of gems. So I decide to abstract these gems into a standalone `Gemfile`. And let those projects’ `Gemfile` loads it. The problem I met is when I building my docker image. I hope that image can pre-install all the ruby gems in that `Gemfile.lock`. Unluckily, `bundle install` require you must have the `Gemfile`. So I have to find out a way to revert `Gemfile.lock` to a usable `Gemfile`. So here we are!
poker evaluation Ruby Interface
Codepad is a remote code evaluation service. reval uses codepad to run code from various languages. Think of it as Ruby's eval from the command line.
Hit your beats.
Evaluate partitionings of different clustering approaches. Provides different metrics to use.
This gem can be used to parse and then evaluate simple latex expressions.
Generator for TF-IDF Document Retrieval in Rails apps using the lightweight RetrievalLite gem.
Object#callwith is like instance_eval, but can still delegate back to the original object if a method is not found. Also unlike instance_eval, all instance variables accessed within the block reference the original self object.
A humane, eval-safe HTML templating system expressed in HTML
Brainstorming of software for a purpose and option to request software as a plugin for crowdsourcing management system voluntary.
Create rovers using this gem and solve the mars-rover challenge
ConfigLeaf allows an object to be configured using a terse syntax like Object#instance_eval, while not exposing the internals (protected/private methods and ivars) of the object!
A Clojure-inspired Lisp dialect that aims to mirror full Ruby functionality. Includes a transpiler that can produce equivalent Ruby code or eval it right away.
Allows Rails applications to use HTTP cache specifications easily.
Evaluate Code & Check Test Cases In a File
This code would show the code evaluated, plus the evaluation result
A minimal testing framework that provides all the features a programmer needs for simple testing. Removed eval in assert, no need to put test in quotes. Made MnmlTestAssertionError error class.
provide Object#context_eval
Adds an `evaulate` refinement method to Proc and Object instances. The goal of this gem is to allow evaluation of variables, procs, and lambdas with the same level of flexibility. The `evaluate` method has been added to the Object class to simply return the value of the variable. The `evaluate` method is overriden on the Proc class to allow parameters to be passed to lambdas in the same flexible way as procs. This takes into consideration, required/optional/remaining parameters, and required/optional/remaining keyword parameters. For information on Refinements, see: - https://ruby-doc.org/core-2.0.0/doc/syntax/refinements_rdoc.html - https://ruby-doc.org/core-2.1.0/doc/syntax/refinements_rdoc.html - https://ruby-doc.org/core-2.2.0/doc/syntax/refinements_rdoc.html - https://ruby-doc.org/core-2.3.0/doc/syntax/refinements_rdoc.html - https://ruby-doc.org/core-2.4.0/doc/syntax/refinements_rdoc.html - http://yehudakatz.com/2010/11/30/ruby-2-0-refinements-in-practice/
Write a longer description or delete this line.
# ruby unshare (runshare) This tool allows to unshare Linux namespaces. The implementation is similar to the unshare(1) tool. ## Installation Add this line to your application's Gemfile: ```ruby gem 'runshare' ``` And then execute: $ bundle Or install it yourself as: $ gem install runshare ## Usage > require "runshare" > RUnshare::unshare For example: cat > test.rb require "runshare" pid = RUnshare::unshare( :clone_newpid => true, :clone_newns => true, :clone_newcgroup => true, :clone_newipc => true, :clone_newuts => true, :clone_newnet => true, :clone_newtime => true, :fork => true, :mount_proc => "/proc", # docker export $(docker create hello-world) | tar -xf - -C rootfs :root => "/tmp/rootfs" ) if pid == 0 # child puts "--- #{Process.pid}" if system("/hello") != true raise "bad" end puts "--- done" else # parent puts "-- unshare=#{pid}, pid=#{Process.pid}" puts "-- exit=#{Process.waitpid(pid)}" end ^D sudo ruby -I ./lib ./test.rb ## Quick start $ rake compile && echo 'require "runshare"; RUnshare::unshare(:clone_newuts => true)' | irb install -c tmp/x86_64-linux/runshare/2.4.10/runshare.so lib/runshare/runshare.so cp tmp/x86_64-linux/runshare/2.4.10/runshare.so tmp/x86_64-linux/stage/lib/runshare/runshare.so Switch to inspect mode. require "runshare"; RUnshare::unshare ## Ruby <2.5 If your app is single threaded and you are observing: eval:1: warning: pthread_create failed for timer: Invalid argument, scheduling broken Just ignore it with some degree of bravity. You also can silence it by setting: $VERBOSE = nil ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/sitano/runshare. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
This gem will check if a coverage file meets the expected level. If it doesn't it will exit with a exit code of 1. This can be used in tools such as Jenkins to check if the coverage meets the expected level.
Evaluate block in the context of singleton class
Most existing gems that address command execution provide a limited interface or lack notable features. In contast, Exek seeks to provide comprehensive support for all of a program's exec needs with one thoughtfully-designed library. Intended features: - A "Command" class that encapsulates argv, env, and IO options, and process state. - Easy-to-use high level interfaces with sensible defaults for running commands to completion. - Comprehensive support for low-level concerns like piping, PTYs, and file descriptor magic. - Utilities for manipulating `sh` script strings, idiomatically building argument arrays, and generating reusable interaces for common system commands. - Tracing and introspection facilities for logging and latency analysis. - Safety: does not monkeypatch external modules, encourage mixins or use eval. Attempts to guide developers away from unsafe practices like shell scripts and shell injection.
A value converting gem.
Tap with instance_eval.
LiveValidation integration with default Rails form helpers and validation methods.
Evaluates input. Caution! Input can be any Ruby expression.
FixtureScenarios, FixtureScenariosBuilder, Yaml and Ruby in one big mix for Rails
Simple API to standardize instrumenting Ruby code
Add Internationalization to your Ruby application.
Gema para acceder al servicio de evaluacion de flag mediante flag token y user id. Como incluir la gema? require "flag_evaluation_service" Como usar la gema? FlagEvaluationService.evaluate("0CD0ugXMh_ChjIrShodLiQ",1)
A secure, non-evaling end user template engine with aesthetic markup.
Auto evaluator for university homeworks for test automation classes.
A simple math operations gem