Transaction::Simple provides a generic way to add active transaction support to objects. The transaction methods added by this module will work with most objects, excluding those that cannot be Marshal-ed (bindings, procedure objects, IO instances, or singleton objects). The transactions supported by Transaction::Simple are not associated with any sort of data store. They are "live" transactions occurring in memory on the object itself. This is to allow "test" changes to be made to an object before making the changes permanent. Transaction::Simple can handle an "infinite" number of transaction levels (limited only by memory). If I open two transactions, commit the second, but abort the first, the object will revert to the original version. Transaction::Simple supports "named" transactions, so that multiple levels of transactions can be committed, aborted, or rewound by referring to the appropriate name of the transaction. Names may be any object except nil. Transaction groups are also supported. A transaction group is an object wrapper that manages a group of objects as if they were a single object for the purpose of transaction management. All transactions for this group of objects should be performed against the transaction group object, not against individual objects in the group. Version 1.4.0 of Transaction::Simple adds a new post-rewind hook so that complex graph objects of the type in tests/tc_broken_graph.rb can correct themselves. Version 1.4.0.1 just fixes a simple bug with #transaction method handling during the deprecation warning. Version 1.4.0.2 is a small update for people who use Transaction::Simple in bundler (adding lib/transaction-simple.rb) and other scenarios where having Hoe as a runtime dependency (a bug fixed in Hoe several years ago, but not visible in Transaction::Simple because it has not needed a re-release). All of the files internally have also been marked as UTF-8, ensuring full Ruby 1.9 compatibility.
Saikuro is a Ruby cyclomatic complexity analyzer. When given Ruby source code Saikuro will generate a report listing the cyclomatic complexity of each method found. In addition, Saikuro counts the number of lines per method and can generate a listing of the number of tokens on each line of code.
Arachni is a feature-full, modular, high-performance Ruby framework aimed towards helping penetration testers and administrators evaluate the security of web applications. It is smart, it trains itself by monitoring and learning from the web application's behavior during the scan process and is able to perform meta-analysis using a number of factors in order to correctly assess the trustworthiness of results and intelligently identify (or avoid) false-positives. Unlike other scanners, it takes into account the dynamic nature of web applications, can detect changes caused while travelling through the paths of a web applicationās cyclomatic complexity and is able to adjust itself accordingly. This way, attack/input vectors that would otherwise be undetectable by non-humans can be handled seamlessly. Moreover, due to its integrated browser environment, it can also audit and inspect client-side code, as well as support highly complicated web applications which make heavy use of technologies such as JavaScript, HTML5, DOM manipulation and AJAX. Finally, it is versatile enough to cover a great deal of use cases, ranging from a simple command line scanner utility, to a global high performance grid of scanners, to a Ruby library allowing for scripted audits, to a multi-user multi-scan web collaboration platform.
When given Ruby source code Saikuro will generate a report listing the cyclomatic complexity of each method found. In addition, Saikuro counts the number of lines per method and can generate a listing of the number of tokens on each line of code.
CMath is a library that provides trigonometric and transcendental functions for complex numbers. The functions in this module accept integers, floating-point numbers or complex numbers as arguments.
You can use this gem to reduce the number of points in a complex polyline / polygon, making use of an optimized Douglas-Peucker algorithm. Ruby port of Simplify.js.
Net::YAIL is an IRC library written in pure Ruby. Using simple functions, it is trivial to build a complex, event-driven IRC application, such as a bot or even a full command-line client. All events can have a single callback and any number of before-callback and after-callback filters. Even outgoing events, such as when you join a channel or send a message, can have filters for stats gathering, text filtering, etc.
Lookout Lookout is a unit testing framework for Rubyā¬ā£ that puts your results in focus. Tests (expectations) are written as follows expect 2 do 1 + 1 end expect ArgumentError do Integer('1 + 1') end expect Array do [1, 2, 3].select{ |i| i % 2 == 0 } end expect [2, 4, 6] do [1, 2, 3].map{ |i| i * 2 } end Lookout is designed to encourage ĪĆĆ“ force, even ĪĆĆ“ unit testing best practices such as ĪĆó Setting up only one expectation per test ĪĆó Not setting expectations on non-public APIs ĪĆó Test isolation This is done by ĪĆó Only allowing one expectation to be set per test ĪĆó Providing no (additional) way of accessing private state ĪĆó Providing no setup and tear-down methods, nor a method of providing test helpers Other important points are ĪĆó Putting the expected outcome of a test in focus with the steps of the calculation of the actual result only as a secondary concern ĪĆó A focus on code readability by providing no mechanism for describing an expectation other than the code in the expectation itself ĪĆó A unified syntax for setting up both state-based and behavior-based expectations The way Lookout works has been heavily influenced by expectationsā¬ā, by {Jay Fields}ā¬ā. The code base was once also heavily based on expectations, based at Subversion {revision 76}Īüā¤. A lot has happened since then and all of the work past that revision are due to {Nikolai Weibull}Īüā”. ā¬ā£ Ruby: http://ruby-lang.org/ ā¬ā Expectations: http://expectations.rubyforge.org/ ā¬ā Jay FieldsĪĆĆs blog: http://blog.jayfields.com/ Īü⤠Lookout revision 76: https://github.com/now/lookout/commit/537bedf3e5b3eb4b31c066b3266f42964ac35ebe Īü┠Nikolai WeibullĪĆĆs home page: http://disu.se/ ā¬Āŗ Installation Install Lookout with % gem install lookout ā¬Āŗ Usage Lookout allows you to set expectations on an objectĪĆĆs state or behavior. WeĪĆĆll begin by looking at state expectations and then take a look at expectations on behavior. ā¬Āŗ Expectations on State: Literals An expectation can be made on the result of a computation: expect 2 do 1 + 1 end Most objects, in fact, have their state expectations checked by invoking ĪĆā£#==ĪĆā on the expected value with the result as its argument. Checking that a result is within a given range is also simple: expect 0.099..0.101 do 0.4 - 0.3 end Here, the more general ĪĆā£#===ĪĆā is being used on the ĪĆā£RangeĪĆā. ā¬Āŗ Regexps ĪĆā£StringsĪĆā of course match against ĪĆā£StringsĪĆā: expect 'ab' do 'abc'[0..1] end but we can also match a ĪĆā£StringĪĆā against a ĪĆā£RegexpĪĆā: expect %r{a substring} do 'a string with a substring' end (Note the use of ĪĆā£%r{ĪĆĀŖ}ĪĆā to avoid warnings that will be generated when Ruby parses ĪĆā£expect /ĪĆĀŖ/ĪĆā.) ā¬Āŗ Modules Checking that the result includes a certain module is done by expecting the ĪĆā£ModuleĪĆā. expect Enumerable do [] end This, due to the nature of Ruby, of course also works for classes (as they are also modules): expect String do 'a string' end This doesnĪĆĆt hinder us from expecting the actual ĪĆā£ModuleĪĆā itself: expect Enumerable do Enumerable end or the ĪĆā£ClassĪĆā: expect String do String end for obvious reasons. As you may have figured out yourself, this is accomplished by first trying ĪĆā£#==ĪĆā and, if it returns ĪĆā£falseĪĆā, then trying ĪĆā£#===ĪĆā on the expected ĪĆā£ModuleĪĆā. This is also true of ĪĆā£RangesĪĆā and ĪĆā£RegexpsĪĆā. ā¬Āŗ Booleans Truthfulness is expected with ĪĆā£trueĪĆā and ĪĆā£falseĪĆā: expect true do 1 end expect false do nil end Results equaling ĪĆā£trueĪĆā or ĪĆā£falseĪĆā are slightly different: expect TrueClass do true end expect FalseClass do false end The rationale for this is that you should only care if the result of a computation evaluates to a value that Ruby considers to be either true or false, not the exact literals ĪĆā£trueĪĆā or ĪĆā£falseĪĆā. ā¬Āŗ IO Expecting output on an IO object is also common: expect output("abc\ndef\n") do |io| io.puts 'abc', 'def' end This can be used to capture the output of a formatter that takes an output object as a parameter. ā¬Āŗ Warnings Expecting warnings from code isnĪĆĆt very common, but should be done: expect warning('this is your final one!') do warn 'this is your final one!' end expect warning('this is your final one!') do warn '%s:%d: warning: this is your final one!' % [__FILE__, __LINE__] end ĪĆā£$VERBOSEĪĆā is set to ĪĆā£trueĪĆā during the execution of the block, so you donĪĆĆt need to do so yourself. If you have other code that depends on the value of $VERBOSE, that can be done with ĪĆā£#with_verboseĪĆā expect nil do with_verbose nil do $VERBOSE end end ā¬Āŗ Errors You should always be expecting errors from ĪĆĆ“ and in, but thatĪĆĆs a different story ĪĆĆ“ your code: expect ArgumentError do Integer('1 + 1') end Often, not only the type of the error, but its description, is important to check: expect StandardError.new('message') do raise StandardError.new('message') end As with ĪĆā£StringsĪĆā, ĪĆā£RegexpsĪĆā can be used to check the error description: expect StandardError.new(/mess/) do raise StandardError.new('message') end ā¬Āŗ Queries Through Symbols Symbols are generally matched against symbols, but as a special case, symbols ending with ĪĆā£?ĪĆā are seen as expectations on the result of query methods on the result of the block, given that the method is of zero arity and that the result isnĪĆĆt a Symbol itself. Simply expect a symbol ending with ĪĆā£?ĪĆā: expect :empty? do [] end To expect itĪĆĆs negation, expect the same symbol beginning with ĪĆā£not_ĪĆā: expect :not_nil? do [1, 2, 3] end This is the same as expect true do [].empty? end and expect false do [1, 2, 3].empty? end but provides much clearer failure messages. It also makes the expectationĪĆĆs intent a lot clearer. ā¬Āŗ Queries By Proxy ThereĪĆĆs also a way to make the expectations of query methods explicit by invoking methods on the result of the block. For example, to check that the even elements of the Array ĪĆā£[1, 2, 3]ĪĆā include ĪĆā£1ĪĆā you could write expect result.to.include? 1 do [1, 2, 3].reject{ |e| e.even? } end You could likewise check that the result doesnĪĆĆt include 2: expect result.not.to.include? 2 do [1, 2, 3].reject{ |e| e.even? } end This is the same as (and executes a little bit slower than) writing expect false do [1, 2, 3].reject{ |e| e.even? }.include? 2 end but provides much clearer failure messages. Given that these two last examples would fail, youĪĆĆd get a message saying ĪĆĀ£[1, 2, 3]#include?(2)ĪĆĀ„ instead of the terser ĪĆĀ£trueĪƫƔfalseĪĆĀ„. It also clearly separates the actual expectation from the set-up. The keyword for this kind of expectations is ĪĆā£resultĪĆā. This may be followed by any of the methods ĪĆó ĪĆā£#notĪĆā ĪĆó ĪĆā£#toĪĆā ĪĆó ĪĆā£#beĪĆā ĪĆó ĪĆā£#haveĪĆā or any other method you will want to call on the result. The methods ĪĆā£#toĪĆā, ĪĆā£#beĪĆā, and ĪĆā£#haveĪĆā do nothing except improve readability. The ĪĆā£#notĪĆā method inverts the expectation. ā¬Āŗ Literal Literals If you need to literally check against any of the types of objects otherwise treated specially, that is, any instances of ĪĆó ĪĆā£ModuleĪĆā ĪĆó ĪĆā£RangeĪĆā ĪĆó ĪĆā£RegexpĪĆā ĪĆó ĪĆā£ExceptionĪĆā ĪĆó ĪĆā£SymbolĪĆā, given that it ends with ĪĆā£?ĪĆā you can do so by wrapping it in ĪĆā£literal(ĪĆĀŖ)ĪĆā: expect literal(:empty?) do :empty? end You almost never need to do this, as, for all but symbols, instances will match accordingly as well. ā¬Āŗ Expectations on Behavior We expect our objects to be on their best behavior. Lookout allows you to make sure that they are. Reception expectations let us verify that a method is called in the way that we expect it to be: expect mock.to.receive.to_str(without_arguments){ '123' } do |o| o.to_str end Here, ĪĆā£#mockĪĆā creates a mock object, an object that doesnĪĆĆt respond to anything unless you tell it to. We tell it to expect to receive a call to ĪĆā£#to_strĪĆā without arguments and have ĪĆā£#to_strĪĆā return ĪĆā£'123'ĪĆā when called. The mock object is then passed in to the block so that the expectations placed upon it can be fulfilled. Sometimes we only want to make sure that a method is called in the way that we expect it to be, but we donĪĆĆt care if any other methods are called on the object. A stub object, created with ĪĆā£#stubĪĆā, expects any method and returns a stub object that, again, expects any method, and thus fits the bill. expect stub.to.receive.to_str(without_arguments){ '123' } do |o| o.to_str if o.convertable? end You donĪĆĆt have to use a mock object to verify that a method is called: expect Object.to.receive.name do Object.name end As you have figured out by now, the expected method call is set up by calling ĪĆā£#receiveĪĆā after ĪĆā£#toĪĆā. ĪĆā£#ReceiveĪĆā is followed by a call to the method to expect with any expected arguments. The body of the expected method can be given as the block to the method. Finally, an expected invocation count may follow the method. LetĪĆĆs look at this formal specification in more detail. The expected method arguments may be given in a variety of ways. LetĪĆĆs introduce them by giving some examples: expect mock.to.receive.a do |m| m.a end Here, the method ĪĆā£#aĪĆā must be called with any number of arguments. It may be called any number of times, but it must be called at least once. If a method must receive exactly one argument, you can use ĪĆā£ObjectĪĆā, as the same matching rules apply for arguments as they do for state expectations: expect mock.to.receive.a(Object) do |m| m.a 0 end If a method must receive a specific argument, you can use that argument: expect mock.to.receive.a(1..2) do |m| m.a 1 end Again, the same matching rules apply for arguments as they do for state expectations, so the previous example expects a call to ĪĆā£#aĪĆā with 1, 2, or the Range 1..2 as an argument on ĪĆā£mĪĆā. If a method must be invoked without any arguments you can use ĪĆā£without_argumentsĪĆā: expect mock.to.receive.a(without_arguments) do |m| m.a end You can of course use both ĪĆā£ObjectĪĆā and actual arguments: expect mock.to.receive.a(Object, 2, Object) do |m| m.a nil, 2, '3' end The body of the expected method may be given as the block. Here, calling ĪĆā£#aĪĆā on ĪĆā£mĪĆā will give the result ĪĆā£1ĪĆā: expect mock.to.receive.a{ 1 } do |m| raise 'not 1' unless m.a == 1 end If no body has been given, the result will be a stub object. To take a block, grab a block parameter and ĪĆā£#callĪĆā it: expect mock.to.receive.a{ |&b| b.call(1) } do |m| j = 0 m.a{ |i| j = i } raise 'not 1' unless j == 1 end To simulate an ĪĆā£#eachĪĆā-like method, ĪĆā£#callĪĆā the block several times. Invocation count expectations can be set if the default expectation of ĪĆĀ£at least onceĪĆĀ„ isnĪĆĆt good enough. The following expectations are possible ĪĆó ĪĆā£#at_most_onceĪĆā ĪĆó ĪĆā£#onceĪĆā ĪĆó ĪĆā£#at_least_onceĪĆā ĪĆó ĪĆā£#twiceĪĆā And, for a given ĪĆā£NĪĆā, ĪĆó ĪĆā£#at_most(N)ĪĆā ĪĆó ĪĆā£#exactly(N)ĪĆā ĪĆó ĪĆā£#at_least(N)ĪĆā ā¬Āŗ Utilities: Stubs Method stubs are another useful thing to have in a unit testing framework. Sometimes you need to override a method that does something a test shouldnĪĆĆt do, like access and alter bank accounts. We can override ĪĆĆ“ stub out ĪĆĆ“ a method by using the ĪĆā£#stubĪĆā method. LetĪĆĆs assume that we have an ĪĆā£AccountĪĆā class that has two methods, ĪĆā£#slipsĪĆā and ĪĆā£#totalĪĆā. ĪĆā£#SlipsĪĆā retrieves the bank slips that keep track of your deposits to the ĪĆā£AccountĪĆā from a database. ĪĆā£#TotalĪĆā sums the ĪĆā£#slipsĪĆā. In the following test we want to make sure that ĪĆā£#totalĪĆā does what it should do without accessing the database. We therefore stub out ĪĆā£#slipsĪĆā and make it return something that we can easily control. expect 6 do |m| stub(Class.new{ def slips raise 'database not available' end def total slips.reduce(0){ |m, n| m.to_i + n.to_i } end }.new, :slips => [1, 2, 3]){ |account| account.total } end To make it easy to create objects with a set of stubbed methods thereĪĆĆs also a convenience method: expect 3 do s = stub(:a => 1, :b => 2) s.a + s.b end This short-hand notation can also be used for the expected value: expect stub(:a => 1, :b => 2).to.receive.a do |o| o.a + o.b end and also works for mock objects: expect mock(:a => 2, :b => 2).to.receive.a do |o| o.a + o.b end Blocks are also allowed when defining stub methods: expect 3 do s = stub(:a => proc{ |a, b| a + b }) s.a(1, 2) end If need be, we can stub out a specific method on an object: expect 'def' do stub('abc', :to_str => 'def'){ |a| a.to_str } end The stub is active during the execution of the block. ā¬Āŗ Overriding Constants Sometimes you need to override the value of a constant during the execution of some code. Use ĪĆā£#with_constĪĆā to do just that: expect 'hello' do with_const 'A::B::C', 'hello' do A::B::C end end Here, the constant ĪĆā£A::B::CĪĆā is set to ĪĆā£'hello'ĪĆā during the execution of the block. None of the constants ĪĆā£AĪĆā, ĪĆā£BĪĆā, and ĪĆā£CĪĆā need to exist for this to work. If a constant doesnĪĆĆt exist itĪĆĆs created and set to a new, empty, ĪĆā£ModuleĪĆā. The value of ĪĆā£A::B::CĪĆā, if any, is restored after the block returns and any constants that didnĪĆĆt previously exist are removed. ā¬Āŗ Overriding Environment Variables Another thing you often need to control in your tests is the value of environment variables. Depending on such global values is, of course, not a good practice, but is often unavoidable when working with external libraries. ĪĆā£#With_envĪĆā allows you to override the value of environment variables during the execution of a block by giving it a ĪĆā£HashĪĆā of key/value pairs where the key is the name of the environment variable and the value is the value that it should have during the execution of that block: expect 'hello' do with_env 'INTRO' => 'hello' do ENV['INTRO'] end end Any overridden values are restored and any keys that werenĪĆĆt previously a part of the environment are removed when the block returns. ā¬Āŗ Overriding Globals You may also want to override the value of a global temporarily: expect 'hello' do with_global :$stdout, StringIO.new do print 'hello' $stdout.string end end You thus provide the name of the global and a value that it should take during the execution of a block of code. The block gets passed the overridden value, should you need it: expect true do with_global :$stdout, StringIO.new do |overridden| $stdout != overridden end end ā¬Āŗ Integration Lookout can be used from Rakeā¬ā£. Simply install Lookout-Rakeā¬ā: % gem install lookout-rake and add the following code to your Rakefile require 'lookout-rake-3.0' Lookout::Rake::Tasks::Test.new Make sure to read up on using Lookout-Rake for further benefits and customization. ā¬ā£ Read more about Rake at http://rake.rubyforge.org/ ā¬ā Get information on Lookout-Rake at http://disu.se/software/lookout-rake/ ā¬Āŗ API Lookout comes with an APIā¬ā£ that letĪĆĆs you create things such as new expected values, difference reports for your types, and so on. ā¬ā£ See http://disu.se/software/lookout/api/ ā¬Āŗ Interface Design The default output of Lookout can Spartanly be described as Spartan. If no errors or failures occur, no output is generated. This is unconventional, as unit testing frameworks tend to dump a lot of information on the user, concerning things such as progress, test count summaries, and flamboyantly colored text telling you that your tests passed. None of this output is needed. Your tests should run fast enough to not require progress reports. The lack of output provides you with the same amount of information as reporting success. Test count summaries are only useful if youĪĆĆre worried that your tests arenĪĆĆt being run, but if you worry about that, then providing such output doesnĪĆĆt really help. Testing your tests requires something beyond reporting some arbitrary count that you would have to verify by hand anyway. When errors or failures do occur, however, the relevant information is output in a format that can easily be parsed by an ĪĆā£'errorformat'ĪĆā for Vim or with {Compilation Mode}ā¬ā£ for Emacsā¬ā. Diffs are generated for Strings, Arrays, Hashes, and I/O. ā¬ā£ Read up on Compilation mode for Emacs at http://www.emacswiki.org/emacs/CompilationMode ā¬ā Visit The GNU FoundationĪĆĆs EmacsĪĆĆ software page at http://www.gnu.org/software/emacs/ ā¬Āŗ External Design LetĪĆĆs now look at some of the points made in the introduction in greater detail. Lookout only allows you to set one expectation per test. If youĪĆĆre testing behavior with a reception expectation, then only one method-invocation expectation can be set. If youĪĆĆre testing state, then only one result can be verified. It may seem like this would cause unnecessary duplication between tests. While this is certainly a possibility, when you actually begin to try to avoid such duplication you find that you often do so by improving your interfaces. This kind of restriction tends to encourage the use of value objects, which are easy to test, and more focused objects, which require simpler tests, as they have less behavior to test, per method. By keeping your interfaces focused youĪĆĆre also keeping your tests focused. Keeping your tests focused improves, in itself, test isolation, but letĪĆĆs look at something that hinders it: setup and tear-down methods. Most unit testing frameworks encourage test fragmentation by providing setup and tear-down methods. Setup methods create objects and, perhaps, just their behavior for a set of tests. This means that you have to look in two places to figure out whatĪĆĆs being done in a test. This may work fine for few methods with simple set-ups, but makes things complicated when the number of tests increases and the set-up is complex. Often, each test further adjusts the previously set-up object before performing any verifications, further complicating the process of figuring out what state an object has in a given test. Tear-down methods clean up after tests, perhaps by removing records from a database or deleting files from the file-system. The duplication that setup methods and tear-down methods hope to remove is better avoided by improving your interfaces. This can be done by providing better set-up methods for your objects and using idioms such as {Resource Acquisition Is Initialization}ā¬ā£ for guaranteed clean-up, test or no test. By not using setup and tear-down methods we keep everything pertinent to a test in the test itself, thus improving test isolation. (You also wonĪĆĆt {slow down your tests}ā¬ā by keeping unnecessary state.) Most unit test frameworks also allow you to create arbitrary test helper methods. Lookout doesnĪĆĆt. The same rationale as that that has been crystallized in the preceding paragraphs applies. If you need helpers youĪĆĆre interface isnĪĆĆt good enough. It really is as simple as that. To clarify: thereĪĆĆs nothing inherently wrong with test helper methods, but they should be general enough that they reside in their own library. The support for mocks in Lookout is provided through a set of test helper methods that make it easier to create mocks than it would have been without them. Lookout-rackā¬ā is another example of a library providing test helper methods (well, one method, actually) that are very useful in testing web applications that use RackĪüā¤. A final point at which some unit test frameworks try to fragment tests further is documentation. These frameworks provide ways of describing the whats and hows of whatĪĆĆs being tested, the rationale being that this will provide documentation of both the test and the code being tested. Describing how a stack data structure is meant to work is a common example. A stack is, however, a rather simple data structure, so such a description provides little, if any, additional information that canĪĆĆt be extracted from the implementation and its tests themselves. The implementation and its tests is, in fact, its own best documentation. Taking the points made in the previous paragraphs into account, we should already have simple, self-describing, interfaces that have easily understood tests associated with them. Rationales for the use of a given data structure or system-design design documentation is better suited in separate documentation focused at describing exactly those issues. ā¬ā£ Read the Wikipedia entry for Resource Acquisition Is Initialization at http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization ā¬ā Read how 37signals had problems with slow Test::Unit tests at http://37signals.com/svn/posts/2742-the-road-to-faster-tests/ ā¬ā Visit the Lookout-rack home page at http://disu.se/software/lookout-rack/ Īü⤠Visit the Rack Rubyforge project page at http://rack.rubyforge.org/ ā¬Āŗ Internal Design The internal design of Lookout has had a couple of goals. ĪĆó As few external dependencies as possible ĪĆó As few internal dependencies as possible ĪĆó Internal extensibility provides external extensibility ĪĆó As fast load times as possible ĪĆó As high a ratio of value objects to mutable objects as possible ĪĆó Each object must have a simple, obvious name ĪĆó Use mix-ins, not inheritance for shared behavior ĪĆó As few responsibilities per object as possible ĪĆó Optimizing for speed can only be done when you have all the facts ā¬Āŗ External Dependencies Lookout used to depend on Mocha for mocks and stubs. While benchmarking I noticed that a method in Mocha was taking up more than 300 percent of the runtime. It turned out that MochaĪĆĆs method for cleaning up back-traces generated when a mock failed was doing something incredibly stupid: backtrace.reject{ |l| Regexp.new(@lib).match(File.expand_path(l)) } Here ĪĆā£@libĪĆā is a ĪĆā£StringĪĆā containing the path to the lib sub-directory in the Mocha installation directory. I reported it, provided a patch five days later, then waited. Nothing happened. {254 days later}ā¬ā£, according to {Wolfram Alpha}ā¬ā, half of my patch was, apparently ĪĆĆ“ I say ĪĆĀ£apparentlyĪĆĀ„, as I received no notification ĪĆĆ“ applied. By that time I had replaced the whole mocking-and-stubbing subsystem and dropped the dependency. Many Ruby developers claim that Ruby and its gems are too fast-moving for normal package-managing systems to keep up. This is testament to the fact that this isnĪĆĆt the case and that the real problem is instead related to sloppy practices. Please note that I donĪĆĆt want to single out the Mocha library nor its developers. I only want to provide an example where relying on external dependencies can be ĪĆĀ£considered harmfulĪĆĀ„. ā¬ā£ See the Wolfram Alpha calculation at http://www.wolframalpha.com/input/?i=days+between+march+17%2C+2010+and+november+26%2C+2010 ā¬ā Check out the Wolfram Alpha computational knowledge engine at http://www.wolframalpha.com/ ā¬Āŗ Internal Dependencies Lookout has been designed so as to keep each subsystem independent of any other. The diff subsystem is, for example, completely decoupled from any other part of the system as a whole and could be moved into its own library at a time where that would be of interest to anyone. WhatĪĆĆs perhaps more interesting is that the diff subsystem is itself very modular. The data passes through a set of filters that depends on what kind of diff has been requested, each filter yielding modified data as it receives it. If you want to read some rather functional Ruby I can highly recommend looking at the code in the ĪĆā£lib/lookout/diffĪĆā directory. This lookout on the design of the library also makes it easy to extend Lookout. Lookout-rack was, for example, written in about four hours and about 5 of those 240 minutes were spent on setting up the interface between the two. ā¬Āŗ Optimizing For Speed The following paragraph is perhaps a bit personal, but might be interesting nonetheless. IĪĆĆve always worried about speed. The original Expectations library used ĪĆā£extendĪĆā a lot to add new behavior to objects. Expectations, for example, used to hold the result of their execution (what we now term ĪĆĀ£evaluationĪĆĀ„) by being extended by a module representing success, failure, or error. For the longest time I used this same method, worrying about the increased performance cost that creating new objects for results would incur. I finally came to a point where I felt that the code was so simple and clean that rewriting this part of the code for a benchmark wouldnĪĆĆt take more than perhaps ten minutes. Well, ten minutes later I had my results and they confirmed that creating new objects wasnĪĆĆt harming performance. I was very pleased. ā¬Āŗ Naming I hate low lines (underscores). I try to avoid them in method names and I always avoid them in file names. Since the current ĪĆĀ£best practiceĪĆĀ„ in the Ruby community is to put ĪĆā£BeginEndStorageĪĆā in a file called ĪĆā£begin_end_storage.rbĪĆā, I only name constants using a single noun. This has had the added benefit that classes seem to have acquired less behavior, as using a single noun doesnĪĆĆt allow you to tack on additional behavior without questioning if itĪĆĆs really appropriate to do so, given the rather limited range of interpretation for that noun. It also seems to encourage the creation of value objects, as something named ĪĆā£RangeĪĆā feels a lot more like a value than ĪĆā£BeginEndStorageĪĆā. (To reach object-oriented-programming Nirvana you must achieve complete value.) ā¬Āŗ News ā¬Āŗ 3.0.0 The ĪĆā£xmlĪĆā expectation has been dropped. It wasnĪĆĆt documented, didnĪĆĆt suit very many use cases, and can be better implemented by an external library. The ĪĆā£argĪĆā argument matcher for mock method arguments has been removed, as it didnĪĆĆt provide any benefit over using Object. The ĪĆā£#yieldĪĆā and ĪĆā£#eachĪĆā methods on stub and mock methods have been removed. They were slightly weird and their use case can be implemented using block parameters instead. The ĪĆā£stubĪĆā method inside ĪĆā£expectĪĆā blocks now stubs out the methods during the execution of a provided block instead of during the execution of the whole except block. When a mock method is called too many times, this is reported immediately, with a full backtrace. This makes it easier to pin down whatĪĆĆs wrong with the code. Query expectations were added. Explicit query expectations were added. Fluent boolean expectations, for example, ĪĆā£expect nil.to.be.nil?ĪĆā have been replaced by query expectations (ĪĆā£expect :nil? do nil endĪĆā) and explicit query expectations (ĪĆā£expect result.to.be.nil? do nil endĪĆā). This was done to discourage creating objects as the expected value and creating objects that change during the course of the test. The ĪĆā£literalĪĆā expectation was added. Equality (ĪĆā£#==ĪĆā) is now checked before ĪĆĀ£caseityĪĆĀ„ (ĪĆā£#===ĪĆā) for modules, ranges, and regular expressions to match the documentation. ā¬Āŗ Financing Currently, most of my time is spent at my day job and in my rather busy private life. Please motivate me to spend time on this piece of software by donating some of your money to this project. Yeah, I realize that requesting money to develop software is a bit, well, capitalistic of me. But please realize that I live in a capitalistic society and I need money to have other people give me the things that I need to continue living under the rules of said society. So, if you feel that this piece of software has helped you out enough to warrant a reward, please PayPal a donation to now@disu.seā¬ā£. Thanks! Your support wonĪĆĆt go unnoticed! ā¬ā£ Send a donation: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=now%40disu%2ese&item_name=Lookout ā¬Āŗ Reporting Bugs Please report any bugs that you encounter to the {issue tracker}ā¬ā£. ā¬ā£ See https://github.com/now/lookout/issues ā¬Āŗ Contributors Contributors to the original expectations codebase are mentioned there. We hope no one on that list feels left out of this list. Please {let us know}ā¬ā£ if you do. ĪĆó Nikolai Weibull ā¬ā£ Add an issue to the Lookout issue tracker at https://github.com/now/lookout/issues ā¬Āŗ Licensing Lookout is free software: you may redistribute it and/or modify it under the terms of the {GNU Lesser General Public License, version 3}ā¬ā£ or laterā¬ā, as published by the {Free Software Foundation}ā¬ā. ā¬ā£ See http://disu.se/licenses/lgpl-3.0/ ā¬ā See http://gnu.org/licenses/ ā¬ā See http://fsf.org/
When given Ruby source code Saikuro will generate a report listing the cyclomatic complexity of each method found. In addition, Saikuro counts the number of lines per method and can generate a listing of the number of tokens on each line of code.
The Number gem is intended to be a drop-in replacement for Ruby's Numeric classes when arbitrary-precision complex interval calculations are warranted. The basis of the arbitrary-precision calculations is the GNU MP, MPFR, and MPC libraries.
Saikuro is a Ruby cyclomatic complexity analyzer. When given Ruby source code Saikuro will generate a report listing the cyclomatic complexity of each method found. In addition, Saikuro counts the number of lines per method and can generate a listing of the number of tokens on each line of code.
When given Ruby source code Saikuro will generate a report listing the cyclomatic complexity of each method found. In addition, Saikuro counts the number of lines per method and can generate a listing of the number of tokens on each line of code.
Ame Ame provides a simple command-line interface API for Ruby¹. It can be used to provide both simple interfaces like that of ā¹rmāŗĀ² and complex ones like that of ā¹gitāŗĀ³. It uses Rubyās own classes, methods, and argument lists to provide an interface that is both simple to use from the command-line side and from the Ruby side. The provided command-line interface is flexible and follows commond standards for command-line processing. ¹ See http://ruby-lang.org/ ² See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html ³ See http://git-scm.com/docs/ § Usage Letās begin by looking at two examples, one where we mimic the POSIX¹ command-line interface to the ā¹rmāŗ command. Looking at the entry² in the standard, ā¹rmāŗ takes the following options: = -f. = Do not prompt for confirmation. = -i. = Prompt for confirmation. = -R. = Remove file hierarchies. = -r. = Equivalent to /-r/. It also takes the following arguments: = FILE. = A pathname or directory entry to be removed. And actually allows one or more of these /FILE/ arguments to be given. We also note that the ā¹rmāŗ command is described as a command to āremove directory entriesā. ¹ See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html ² See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/rm.html Letās turn this specification into one using Ameās API. We begin by adding a flag for each of the options listed above: class Rm < Ame::Root flag 'f', '', false, 'Do not prompt for confirmation' flag 'i', '', nil, 'Prompt for confirmation' do |options| options['f'] = false end flag 'R', '', false, 'Remove file hierarchies' flag 'r', '', nil, 'Equivalent to -R' do |options| options['r'] = true end A flag¹ is a boolean option that doesnāt take an argument. Each flag gets a short and long name, where an empty name means that thereās no corresponding short or long name for the flag, a default value (true, false, or nil), and a description of what the flag does. Each flag can also optionally take a block that can do further processing. In this case we use this block to modify the Hash that maps option names to their values passed to the block to set other flagsā values than the ones that the block is associated with. As these flags (āiā and ārā) arenāt themselves of interest, their default values have been set to nil, which means that they wonāt be included in the Hash that maps option names to their values when passed to the method. ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#flag-class-method There are quite a few other kinds of options besides flags that can be defined using Ame, but flags are all that are required for this example. Weāll get to the other kinds in later examples. Next we add a āsplusā argument. splus 'FILE', String, 'File to remove' A splus¹ argument is like a Ruby āsplatā, that is, an Array argument at the end of the argument list to a method preceded by a star, except that a splus requires at least one argument. A splus argument gets a name for the argument (ā¹FILEāŗ), the type of argument it represents (String), and a description. ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#splus-class-method Then we add a description of the command (method) itself: description 'Remove directory entries' Descriptions¹ will be used in help output to assist the user in using the command. ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#description-class-method Finally, we add the Ruby method thatāll implement the command (all preceding code included here for completeness): class Rm < Ame::Root version '1.0.0' flag 'f', '', false, 'Do not prompt for confirmation' flag 'i', '', nil, 'Prompt for confirmation' do |options| options['f'] = false end flag 'R', '', false, 'Remove file hierarchies' flag 'r', '', nil, 'Equivalent to -R' do |options| options['r'] = true end splus 'FILE', String, 'File to remove' description 'Remove directory entries' def rm(files, options = {}) require 'fileutils' FileUtils.send options['R'] ? :rm_r : :rm, [first] + rest, :force => options['f'] end end Actually, another bit of code was also added, namely version '1.0.0' This sets the version¹ String of the command. This information is used when the command is invoked with the āā¹--versionāŗā flag. This flag is automatically added, so you donāt need to add it yourself. Another flag, āā¹--helpāŗā, is also added automatically. When given, this flagāll make Ame output usage information of the command. ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#version-class-method To actually run the command, all you need to do is invoke Rm.process Thisāll invoke the command using the command-line arguments stored in ā¹ARGVāŗ, but you can also specify other ones if you want to: Rm.process 'rm', %w[-r /tmp/*] The first argument to #process¹ is the name of the method to invoke, which defaults to ā¹File.basename($0)āŗ, and the second argument is an Array of Strings that should be processed as command-line arguments passed to the command. ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#process-class-method If youād store the complete ā¹Rmāŗ class defined above in a file called ā¹rmāŗ and add ā¹#! /usr/bin/ruby -wāŗ at the beginning and ā¹Rm.processāŗ at the end, youād have a fully functional ā¹rmāŗ command (after making it executable). Letās see it in action: % rm --help Usage: rm [OPTIONS]... FILE... Remove directory entries Arguments: FILE... File to remove Options: -R Remove file hierarchies -f Do not prompt for confirmation --help Display help for this method -i Prompt for confirmation -r Equivalent to -R --version Display version information % rm --version rm 1.0.0 Some commands are more complex than ā¹rmāŗ. For example, ā¹gitāŗĀ¹ has a rather complex command-line interface. We wonāt mimic it all here, but letās introduce the rest of the Ame API using a fake ā¹gitāŗ clone as an example. ¹ See http://git-scm.com/docs/ ā¹Gitāŗ uses sub-commands to achieve most things. Implementing sub-commands with Ame is done using a ādispatchā. Weāll discuss dispatches in more detail later, but suffice it to say that a dispatch delegates processing to a child class thatāll handle the sub-command in question. We begin by defining our main ā¹gitāŗ command using a class called ā¹Gitāŗ under the ā¹Git::CLIāŗ namespace: module Git end class Git::CLI < Ame::Root version '1.0.0' class Git < Ame::Class description 'The stupid content tracker' def initialize; end Weāre setting things up to use the ā¹Gitāŗ class as a dispatch in the ā¹Git::CLIāŗ class. The description on the ā¹initializeāŗ method will be used as a description of the ā¹gitāŗ dispatch command itself. Next, letās add the ā¹format-patchāŗĀ¹ sub-command: description 'Prepare patches for e-mail submission' flag ?n, 'numbered', false, 'Name output in [PATCH n/m] format' flag ?N, 'no-numbered', nil, 'Name output in [PATCH] format' do |options| options['numbered'] = false end toggle ?s, 'signoff', false, 'Add Signed-off-by: line to the commit message' switch '', 'thread', 'STYLE', nil, Ame::Types::Enumeration[:shallow, :deep], 'Controls addition of In-Reply-To and References headers' flag '', 'no-thread', nil, 'Disables addition of In-Reply-To and Reference headers' do |options, _| options.delete 'thread' end option '', 'start-number', 'N', 1, 'Start numbering the patches at N instead of 1' multioption '', 'to', 'ADDRESS', String, 'Add a To: header to the email headers' optional 'SINCE', 'N/A', 'Generate patches for commits after SINCE' def format_patch(since = '', options = {}) p since, options end ¹ See http://git-scm.com/docs/git-format-patch/ Weāre using quite a few new Ame commands here. Letās look at each in turn: toggle ?s, 'signoff', false, 'Add Signed-off-by: line to the commit message' A ātoggleā¹ is a flag that also has an inverse. Beyond the flags āsā and āsignoffā, the toggle also defines āno-signoffā, which will set āsignoffā to false. This is useful if you want to support configuration files that set āsignoffāās default to true, but still allow it to be overridden on the command line. ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#toggle-class-method When using the short form of a toggle (and flag and switch), multiple ones may be juxtaposed after the initial one. For example, āā¹-snāŗā is equivalent to āā¹-s -nāŗā to āgit format-patchāŗā. switch '', 'thread', 'STYLE', nil, Ame::Types::Enumeration[:shallow, :deep], 'Controls addition of In-Reply-To and References headers' A āswitchā¹ is an option that takes an optional argument. This allows you to have separate defaults for when the switch isnāt present on the command line and for when itās given without an argument. The third argument to a switch is the name of the argument. Weāre also introducing a new concept here in ā¹Ame::Types::Enumerationāŗ. An enumeration² allows you to limit the allowed input to a set of Symbols. An enumeration also has a default value in the first item to its constructor (which is aliased as ā¹.[]āŗ). In this case, the āthreadā switch defaults to nil, but, when given, will default to ā¹:shallowāŗ if no argument is given. If an argument is given it must be either āshallowā or ādeepā. A switch isnāt required to take an enumeration as its argument default and can take any kind of default value for its argument that Ame knows how to handle. Weāll look at this in more detail later, but know that the type of the default value will be used to inform Ame how to parse a command-line argument into a Ruby value. An argument to a switch must be given, in this case, as āā¹--thread=deepāŗā on the command line. ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#switch-class-method ² See http://disu.se/software/ame-1.0/api/user/Ame/Types/Enumeration/ option '', 'start-number', 'N', 1, 'Start numbering the patches at N instead of 1' An āoptionā¹ is an option that takes an argument. The argument must always be present and may be given, in this case, as āā¹--start-number=2āŗā or āā¹--start-number 2āŗā on the command line. For a short-form option, anything that follows the option is seen as an argument, so assuming that āstart-numberā also had a short name of āSā, āā¹-S2āŗā would be equivalent to āā¹-S 2āŗā, which would be equivalent to āā¹--start-number 2āŗā. Note that āā¹-snS2āŗā would still work as expected. ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#option-class-method multioption '', 'to', 'ADDRESS', String, 'Add a To: header to the email headers' A āmultioptionā¹ is an option that takes an argument and may be repeated any number of times. Each argument will be added to an Array stored in the Hash that maps option names to their values. Instead of taking a default argument, it takes a type for the argument (String, in this case). Again, types are used to inform Ame how to parse command-line arguments into Ruby values. ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#multioption-class-method optional 'SINCE', 'N/A', 'Generate patches for commits after SINCE' An āoptionalā¹ argument is an argument that isnāt required. If itās not present on the command line itāll get its default value (the String ā¹'N/A'āŗ, in this case). ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#optional-class-method Weāve now covered all kinds of options and one new kind of argument. There are three more types of argument (one that weāve already seen and two new) that weāll look into now: āargumentā, āsplatā, and āsplusā. description 'Annotate file lines with commit information' argument 'FILE', String, 'File to annotate' def annotate(file) p file end An āargumentā¹ is an argument thatās required. If itās not present on the command line, an error will be raised (and by default reported to the terminal). As itās required, it doesnāt take a default, but rather a type. ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#argument-class-method description 'Add file contents to the index' splat 'PATHSPEC', String, 'Files to add content from' def add(paths) p paths end A āsplatā¹ is an argument thatās not required, but may be given any number of times. The type of a splat is the type of one argument and the type of a splat as a whole is an Array of values of that type. ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#splat-class-method description 'Display gitattributes information' splus 'PATHNAME', String, 'Files to list attributes of' def check_attr(paths) p paths end A āsplusā¹ is an argument thatās required, but may also be given any number of times. The type of a splus is the type of one argument and the type of a splus as a whole is an Array of values of that type. ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#splus-class-method Now that weāve seen all kinds of options and arguments, letās look on an additional tool at our disposal, the dispatch¹. class Remote < Ame::Class description 'Manage set of remote repositories' def initialize; end description 'Shows a list of existing remotes' flag 'v', 'verbose', false, 'Show remote URL after name' def list(options = {}) p options end description 'Adds a remote named NAME for the repository at URL' argument 'name', String, 'Name of the remote to add' argument 'url', String, 'URL to the repository of the remote to add' def add(name, url) p name, url end end ¹ See http://disu.se/software/ame-1.0/api/user/Ame/Class#dispatch-class-method Here weāre defining a child class to Git::CLI::Git called āRemoteā that doesnāt introduce anything new. Then we set up the dispatch: dispatch Remote, :default => 'list' This adds a method called āremoteā to Git::CLI::Git that will dispatch processing of the command line to an instance of the Remote class when āā¹git remoteāŗā is seen on the command line. The āremoteā method expects an argument thatāll be used to decide what sub-command to execute. Here weāve specified that in the absence of such an argument, the ālistā method should be invoked. We add the same kind of dispatch to Git under Git::CLI: dispatch Git and then weāre done. Hereās all the previous code in its entirety: module Git end class Git::CLI < Ame::Root version '1.0.0' class Git < Ame::Class description 'The stupid content tracker' def initialize; end description 'Prepare patches for e-mail submission' flag ?n, 'numbered', false, 'Name output in [PATCH n/m] format' flag ?N, 'no-numbered', nil, 'Name output in [PATCH] format' do |options| options['numbered'] = false end toggle ?s, 'signoff', false, 'Add Signed-off-by: line to the commit message' switch '', 'thread', 'STYLE', nil, Ame::Types::Enumeration[:shallow, :deep], 'Controls addition of In-Reply-To and References headers' flag '', 'no-thread', nil, 'Disables addition of In-Reply-To and Reference headers' do |options, _| options.delete 'thread' end option '', 'start-number', 'N', 1, 'Start numbering the patches at N instead of 1' multioption '', 'to', 'ADDRESS', String, 'Add a To: header to the email headers' optional 'SINCE', 'N/A', 'Generate patches for commits after SINCE' def format_patch(since = '', options = {}) p since, options end description 'Annotate file lines with commit information' argument 'FILE', String, 'File to annotate' def annotate(file) p file end description 'Add file contents to the index' splat 'PATHSPEC', String, 'Files to add content from' def add(paths) p paths end description 'Display gitattributes information' splus 'PATHNAME', String, 'Files to list attributes of' def check_attr(paths) p paths end class Remote < Ame::Class description 'Manage set of remote repositories' def initialize; end description 'Shows a list of existing remotes' flag 'v', 'verbose', false, 'Show remote URL after name' def list(options = {}) p options end description 'Adds a remote named NAME for the repository at URL' argument 'name', String, 'Name of the remote to add' argument 'url', String, 'URL to the repository of the remote to add' def add(name, url) p name, url end end dispatch Remote, :default => 'list' end dispatch Git end If we put this code in a file called āgitā and add ā¹#! /usr/bin/ruby -wāŗ at the beginning and ā¹Git::CLI.processāŗ at the end, youāll have a very incomplete git command-line interface on your hands. Letās look at what some of its ā¹--helpāŗ output looks like: % git --help Usage: git [OPTIONS]... METHOD [ARGUMENTS]... The stupid content tracker Arguments: METHOD Method to run [ARGUMENTS]... Arguments to pass to METHOD Options: --help Display help for this method --version Display version information Methods: add Add file contents to the index annotate Annotate file lines with commit information check-attr Display gitattributes information format-patch Prepare patches for e-mail submission remote Manage set of remote repositories % git format-patch --help Usage: git format-patch [OPTIONS]... [SINCE] Prepare patches for e-mail submission Arguments: [SINCE=N/A] Generate patches for commits after SINCE Options: -N, --no-numbered Name output in [PATCH] format --help Display help for this method -n, --numbered Name output in [PATCH n/m] format --no-thread Disables addition of In-Reply-To and Reference headers -s, --signoff Add Signed-off-by: line to the commit message --start-number=N Start numbering the patches at N instead of 1 --thread[=STYLE] Controls addition of In-Reply-To and References headers --to=ADDRESS* Add a To: header to the email headers % git remote --help Usage: git remote [OPTIONS]... [METHOD] [ARGUMENTS]... Manage set of remote repositories Arguments: [METHOD=list] Method to run [ARGUMENTS]... Arguments to pass to METHOD Options: --help Display help for this method Methods: add Adds a remote named NAME for the repository at URL list Shows a list of existing remotes § API The previous section gave an introduction to the whole user API in an informal and introductory way. For an indepth reference to the user API, see the {user API documentation}¹. ¹ See http://disu.se/software/ame-1.0/api/user/Ame/ If you want to extend the API or use it in some way other than as a command-line-interface writer, see the {developer API documentation}¹. ¹ See http://disu.se/software/ame-1.0/api/developer/Ame/ § Financing Currently, most of my time is spent at my day job and in my rather busy private life. Please motivate me to spend time on this piece of software by donating some of your money to this project. Yeah, I realize that requesting money to develop software is a bit, well, capitalistic of me. But please realize that I live in a capitalistic society and I need money to have other people give me the things that I need to continue living under the rules of said society. So, if you feel that this piece of software has helped you out enough to warrant a reward, please PayPal a donation to now@disu.se¹. Thanks! Your support wonāt go unnoticed! ¹ Send a donation: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=now@disu.se&item_name=Ame § Reporting Bugs Please report any bugs that you encounter to the {issue tracker}¹. ¹ See https://github.com/now/ame/issues § Authors Nikolai Weibull wrote the code, the tests, the documentation, and this README. § Licensing Ame is free software: you may redistribute it and/or modify it under the terms of the {GNU Lesser General Public License, version 3}¹ or later², as published by the {Free Software Foundation}³. ¹ See http://disu.se/licenses/lgpl-3.0/ ² See http://gnu.org/licenses/ ³ See http://fsf.org/
This gem is a United States phone number validator. This gem uses a complex regular expression that can validate any United States phone number. Check out the documentation under the links section to see how to use this gem.
Ruby bindings of MPC that is C library for complex number of multiple precision
Saikuro is a Ruby cyclomatic complexity analyzer. When given Ruby source code Saikuro will generate a report listing the cyclomatic complexity of each method found. In addition, Saikuro counts the number of lines per method and can generate a listing of the number of tokens on each line of code.
This gem creates a thin shell to encapsulate primitive literal types such as integers, floats and symbols. There are a family of wrappers which mimic the behavior of what they contain. Primitive types have several drawbacks: no constructor to call, can't create instance variables, and can't create singleton methods. There is some utility in wrapping a primitive type. You can simulate a call by reference for example. You can also simulate mutability, and pointers. Some wrappers are dedicated to holding a single type while others may hold a family of types such as the `Number` wrapper. What is interesting to note is Number objects do not derive from `Numeric`, but instead derive from `Value` (the wrapper base class); but at the same time, `Number` objects mimic the methods of `Fixnum`, `Complex`, `Float`, etc. Many of the wrappers can be used in an expression without having to call an access method. There are also new types: `Bool` which wraps `true,false` and `Property` which wraps `Hash` types. The `Property` object auto-methodizes the key names of the Hash. Also `Fraction` supports mixed fractions.
Performs basic Mathematical Operations on Complex Numbers
# Quick Start The Owner API uses the JSON format, and must be accessed over a [secure connection](https://en.wikipedia.org/wiki/HTTPS). Letās assume that the access token provided by your account manager is āTOKENā. Hereās how to get the list of ids of all your invoices from the first week of August with a shell script: ```bash query="end_date=2018-08-08T00%3A00%3A00%2B00%3A00&start_date=2018-08-01T00%3A00%3A00%2B00%3A00" curl -i "https://api-eu.getaround.com/owner/v1/invoices?${query}" \ -H "Authorization: Bearer TOKEN" \ -H "Accept:application/json" \ -H "Content-Type:application/json" ``` And hereās how to get the invoice with the id 12345: ```bash curl -i "https://api-eu.getaround.com/owner/v1/invoices/12345" \ -H "Authorization: Bearer TOKEN" \ -H "Accept: application/json" \ -H "Content-Type: application/json"" ``` See the [endpoints section](#tag/Invoices) of this guide for details about the response format. Dates in request params should follow the ISO 8601 standard. # Authentication All requests must be authenticated with a [bearer token header](https://tools.ietf.org/html/rfc6750#section-2.1). You token will be sent to you by your account manager. Unauthenticated requests will return a 401 status. # Pagination The page number and the number of items per page can be set with the āpageā and āper_pageā params. For example, this request will return the second page of invoices, and 50 invoices per page: `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` Both of these params are optional. The default page size is 30 items. The Getaround Owner API follows the [RFC 8288 convention](https://datatracker.ietf.org/doc/html/rfc8288) of using the `Link` header to provide the `next` page URL. Please don't build the pagination URLs yourself. The `next` page will be missing when you are requesting the last available page. Here's an example response header from requesting the second page of invoices `https://api-eu.getaround.com/owner/v1/invoices?page=2&per_page=50` ``` Link: <https://api-eu.getaround.com/owner/v1/invoices?page=3&per_page=50>; rel="next" ``` # Throttling policy and Date range limitation We have throttling policy that prevents you to perform more than 100 requests per min from the same IP. Also, there is a limitation on the size of the range of dates given in params in some requests. All requests that need start_date and end_date, do not accept a range bigger than 30 days. # Webhooks Getaround can send webhook events that notify your application when certain events happen on your account. This is especially useful to follow the lifecycle of rentals, tracking for example bookings or cancellations. ### Setup To set up an endpoint, you need to define a route on your server for receiving events, and then <a href="mailto:owner-api@getaround.com">ask Getaround</a> to add this URL to your account. To acknowledge receipt of a event, your endpoint must: - Return a `2xx` HTTP status code. - Be a secure `https` endpoint with a valid SSL certificate. ### Testing Once Getaround has set up the endpoint, and it is properly configured as described above, a test `ping` event can be sent by clicking the button below: <form action="/docs/api/owner/fire_ping_webhook" method="post"><input type="submit" value="Send Ping Event"></form> You should receive the following JSON payload: ```json { "data": { "ping": "pong" }, "type": "ping", "occurred_at": "2019-04-18T08:30:05Z" } ``` ### Retries Webhook deliveries will be attempted for up to three days with an exponential back off. After that point the delivery will be abandoned. ### Verifying Signatures Getaround will also provide you with a secret token, which is used to create a hash signature with each payload. This hash signature is passed along with each request in the headers as `X-Drivy-Signature`. Suppose you have a basic server listening to webhooks that looks like this: ```ruby require 'sinatra' require 'json' post '/payload' do push = JSON.parse(params[:payload]) "I got some JSON: #{push.inspect}" end ``` The goal is to compute a hash using your secret token, and ensure that the hash from Getaround matches. Getaround uses an HMAC hexdigest to compute the hash, so you could change your server to look a little like this: ```ruby post '/payload' do request.body.rewind payload_body = request.body.read verify_signature(payload_body) push = JSON.parse(params[:payload]) "I got some JSON: #{push.inspect}" end def verify_signature(payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), ENV['SECRET_TOKEN'], payload_body) return halt 500, "Signatures didn't match!" unless Rack::Utils.secure_compare(signature, request.env['HTTP_X_DRIVY_SIGNATURE']) end ``` Obviously, your language and server implementations may differ from this code. There are a couple of important things to point out, however: No matter which implementation you use, the hash signature starts with `sha1=`, using the key of your secret token and your payload body. Using a plain `==` operator is not advised. A method like secure_compare performs a "constant time" string comparison, which renders it safe from certain timing attacks against regular equality operators. ### Best Practices - **Acknowledge events immediately**. If your webhook script performs complex logic, or makes network calls, itās possible that the script would time out before Getaround sees its complete execution. Ideally, your webhook handler code (acknowledging receipt of an event by returning a `2xx` status code) is separate of any other logic you do for that event. - **Handle duplicate events**. Webhook endpoints might occasionally receive the same event more than once. We advise you to guard against duplicated event receipts by making your event processing idempotent. One way of doing this is logging the events youāve processed, and then not processing already-logged events. - **Do not expect events in order**. Getaround does not guarantee delivery of events in the order in which they are generated. Your endpoint should therefore handle this accordingly. We do provide an `occurred_at` timestamp for each event, though, to help reconcile ordering.
# foundationallib <h2>Finally, a cross-platform, portable, well-designed, secure, robust, maximally-efficient C foundational library — Making Engineering And Computing Fast, Secure, Responsive And Easy.</h2> <br> <h2><i>Library Uses - What It Does, What It Is, And What It Is A Solution For</i></h2> <ul class="features-list"> <li><strong>Enables better Engineering Solutions and Security broadly and foundationally where Software Creation or Development or Script Creation is concerned - whether this be on a local, business, governmental or international basis, and makes things easier - and Computing in General.</strong> Don't Reinvent the Wheel - Use Good Wheels - Be Safe And Secure.</li> <br> <li><strong>Enables a free-flowing dynamic computer usage that you need, deserve and should have, simply because you have a computer. With full speed and with robustness. You deserve to be able to use your computer wholly and fully, with proper and fast operations.</strong></li> <br><li><strong>Enables flexibility and power - makes C accessible to the masses (and faster and more secure) with easy usage and strives to bring people up, not degrade the character or actions of people.</strong> This is a fundamental and unequivocal philosophy difference between this library and many subsections of Software Engineering and the mainstream engineering establishment. For instance, in Python, you cannot read a file easily – you have to read it line-by-line or open a file, read the lines, then close it. With this library, you can efficiently read 10,000 files in one function call. This library gives power. Any common operation, there ought to be a powerful function for.<br><br>We should not bitch around with assembly when we don't want to; we should also have full speed. Some old "solutions" deliver neither, then culturally degrade programmers because their tools are bad - actually, it just degrades programmers, and gives them bad tools. COBOL is an example ...<br><br>Human technology is about empowerment – people must fight for it to be empowerment, we don't have time to have AI systems kill us because we want to have bad tools and be weak. We must fight.</li> </ul> <br> <ul> <h2><i>About Foundationallib</i></h2> <li>ā<strong>Cross platform</strong> - works perfectly in embedded, server, desktop, and all platforms - tested for Windows and UNIX - 64-bit and 32-bit, includes a 3-aspect test suite, with more to come.</li> <li>ā<strong>Bug free. Reliable. Dependable. Secure. Tested well.</strong></li> <li>ā<strong>Zero Overhead</strong> - Only 1 byte due to the power of the error handling, can be configured will full power.</li> <li>ā<strong>Static Inline Functions if you want them</strong> (optional) - Eliminating function call overhead to 0 if you wish, for improved performance.</li> <li>ā<strong>Custom allocators</strong> - if you want it.</li> <li>ā<strong>Custom error handling</strong> - if you want it.</li> <li>ā<strong>Safe functions</strong> warn the programmer about NULL values and unused return values. Can be configured to not compile if not Secure. Optional null-check macros in every library function. Does not use any of <code>"gets", "fgets", "strcpy", "strcat", "sprintf", "vsprintf", "scanf", "fscanf", "system", "chown", "chmod", "chgrp", "alloca", "execl", "execle", "execlp", "execv", "execve", "execvp", "bcopy", "bzero"</code>. You can configure it to never use any unsafe functions.</li> <li>ā<strong>Portable</strong> - works on all platforms, using platform specific features (using #ifdefs) to make functions better and faster.</li> <li>ā<strong>Multithreading support</strong> (optional), with list_comprehension_multithreaded (accepts any number of threads, works in parallel using portable C11 threads)</li> <li>ā<strong>Networking support</strong> (optional), using libcurl - making it extremely easy to download websites and arrays of websites - features other languages do not have.</li> <li>āVery good and thorough <strong>Error Handling</strong> and <strong>allocation overflow</strong> checking (good for <strong>Security and Robustness</strong>) in the functions. Allows the programmer to dynamically choose to catch all errors in the functions with a handler (default or custom), or to ignore them. No need to ALWAYS say "if (.....) if you don't want to. Can be changed at runtime.</li> <li>ā<strong>Public Domain</strong> so you make the code how you want. (No need to "propitiate" to some "god" of some library).</li> <li>ā<strong>Minimal abstractions or indirection of any kind or needless slow things that complicate things</strong> - macros, namespace collision, typedefs, structs, object-orientation messes, slow compilation times, bloat, etc., etc.</li> <li>ā<strong>No namespace pollution</strong> - you can generate your <span style=font-style:normal;><b>own version</b></span> with any prefix you like!</li> <li>ā<strong>Relies <span style=font-style:normal;>minimally</span> on C libraries - it can be fully decoupled from LIB C and can be statically linked.</strong></li> <li>ā<span style=font-style:normal;><b>Very small</b></span> - 13K Lines of Code (including Doxygen comments and following of Best Practices)</li> <li>ā<strong>No Linkage Issues or dependency hell</strong></li> <li>ā<strong>Thorough and clear documentation</strong>, with examples of usage.</li> <li>ā<strong>No licensing restrictions whatsoever - use it for your engineering project, your startup, your Fortune 500 company, your personal project, your throw-away script, your government.</strong></li> <li>ā<strong>Makes C like Python or Perl or Ruby in many ways - or more easy</strong></li> <li>ā<strong>Easy Straightforward Transpilation Support</strong> - to make current code, much faster - all without any bloat (See transpile_slow_scripting_into_c.rb). <li><h4>In many cases, there is now a direct mapping of functions from other languages into optimized C. See the example script in this repository. This makes optimizing your Python / Perl / Ruby / PHP etc. script very easy, either manually or through the use of AI.</h4></li> </ul> </p> </div> <div class=pane style='border: 0;border-right: 1px dotted rgb(200, 200, 200); background-color: rgb(255, 255, 190);'> <div class="library-details"><h2 style=color:green;><i>Foundationallib Features</i></h2> <p class=feature> <strong>Functional Programming Features</strong> - <code>map, reduce, filter,</code> List Comprehensions in C and much more!</p> <p class=feature><strong>Expands C's Primitives for easy manipulation of data types</strong> such as Arrays, Strings, <code>Dict</code>, <code>Set</code>, <code>FrozenDict</code>, <code>FrozenSet</code> - <strong>and enables easy manipulation, modification, alteration, comparison, sorting, counting, IO (printing) and duplication of these at a very comfortable level</strong> - something very, very rare in C or C++, <i>all without any overhead.</i></p> <p class=feature><strong>More comfortable IO</strong> - read and write entire files with ease, and convert complex types into strings or print them on the screen with ease. </p> <p class=feature><strong>A powerful general purpose Foundational Library</strong> - <i>which has anything and everything you need</i> - from <code>replace_all()</code> to <code>replace_memory()</code> to <code>find_last_of()</code> to to <code>list_comprehension()</code> to <code>shellescape()</code> to <code>read_file_into_string()</code> to <code>string_to_json()</code> to <code>string_to_uppercase()</code> to <code>to_title_case()</code> to <code>read_file_into_array()</code> to <code>read_files_into_array()</code> to <code>map()</code> to <code>reduce()</code> to <code>filter()</code> to <code>list_comprehension_multithreaded()</code> to <code>frozen_dict_new_instance()</code> to <code>backticks()</code> - everything you would want to make quick and optimally efficient C programs, this has it.</p> <div style='height: 1px; border: 0;border-bottom: 1px dashed rgb(200, 200, 200);'></div> <p class=performance><span>Helps to make programs hundreds of times faster than other languages with similar ease of creation.</span> <hr> <p class=feature><strong>Easily take advantage of CPU cores with list_comprehension_multithreaded()</strong>.<br><br>You can specify the number of threads, the transform and the filter functions, and this will transform your data - all in parallel. Don't have a multithreaded environment? Then disable it (set the flag).</p> <hr> <h3>You don't want to be reinventing the wheel and hoping that your memory allocation is secure enough - and then failing. <strong>Security Is Paramount.</strong></h3> <h3>You don't want to be waiting <span style='color:rgb(240, 0, 0);'>a day</span> for an operation to complete when it could take <span style='color:rgb(30, 30, 255);'>less than an hour</span>.</h3> <br><p>This library is founded on very strong and unequivocal goals and philosophy. In fact, I have written many articles about the foundation of this library and more relevantly the broader context. See the Articles folder - for some of the foundation of this library.</p> <br><p>This library is an ideal and a dream - not just a Software Library. As such, I would highly suggest that you support me in this mission. Even if it's different from the status quo. Are you a Rust or Zig fan? Then make a Rust or Zig version of this ideal. Let's go. Give me an email.</p> </div> </div> <br> No Copyright - Public Domain - 2023, Gregory Cohen <gregorycohennew@gmail.com> DONATION REQUEST: If this free software has helped you and you find it valuable, please consider making a donation to support the ongoing development and maintenance of this project. Your contribution helps ensure the availability of this library to the community and encourages further improvements. Donations can be made at: https://www.paypal.com/paypalme/cfoundationallib Note: The best way to contact me is through email, not social media. Please feel very free to email me if you want to express feedback, suggest an improvement, desire to collaborate on this free and open source project, want to support me, or want to create something great. Complacency and obstructionism and whining are not tolerated. I desire to make this library the best theoretically possible, so please, let us connect. <h1>This code is in the public domain, fully. You can do whatever you want with it. See docs.html for API reference.  </h1> <h1>Here's some examples of some things you can do easily with Foundationallib.<br><br> <h3>Use it for scripting purposes...</h3> </h1>  <h1>Take control of the Web - in C.<br><br></h1> 
# foundationallib <h2>Finally, a cross-platform, portable, well-designed, secure, robust, maximally-efficient C foundational library — Making Engineering And Computing Fast, Secure, Responsive And Easy.</h2> <br> <ul class="features-list"> <li><strong>Enables better Engineering Solutions and Security broadly and foundationally where Software Creation or Development or Script Creation is concerned - whether this be on a local, business, governmental or international basis, and makes things easier - and Computing in General.</strong> Don't Reinvent the Wheel - Use Good Wheels - Be Safe And Secure.</li> <br> <li><strong>Enables a free-flowing dynamic computer usage that you need, deserve and should have, simply because you have a computer. With full speed and with robustness. You deserve to be able to use your computer wholly and fully, with proper and fast operations.</strong></li> <br><li><strong>Enables flexibility and power - makes C accessible to the masses (and faster and more secure) with easy usage and strives to bring people up, not degrade the character or actions of people.</strong> This is a fundamental and unequivocal philosophy difference between this library and many subsections of Software Engineering and the mainstream engineering establishment. For instance, in Python, you cannot read a file easily – you have to read it line-by-line or open a file, read the lines, then close it. With this library, you can efficiently read 10,000 files in one function call. This library gives power. Any common operation, there ought to be a powerful function for.<br><br>We should not bitch around with assembly when we don't want to; we should also have full speed. Some old "solutions" deliver neither, then culturally degrade programmers because their tools are bad - actually, it just degrades programmers, and gives them bad tools. COBOL is an example ...<br><br>Human technology is about empowerment – people must fight for it to be empowerment, we don't have time to have AI systems kill us because we want to have bad tools and be weak. We must fight.</li> </ul> <br> <ul> <h2>About Foundationallib</h2> <li>ā<strong>Cross platform</strong> - works perfectly in embedded, server, desktop, and all platforms - tested for Windows and UNIX - 64-bit and 32-bit, includes a 3-aspect test suite, with more to come.</li> <li>ā<strong>Bug free. Reliable. Dependable. Secure. Tested well.</strong></li> <li>ā<strong>Zero Overhead</strong> - Only 1 byte due to the power of the error handling, can be configured will full power.</li> <li>ā<strong>Static Inline Functions if you want them</strong> (optional) - Eliminating function call overhead to 0 if you wish, for improved performance.</li> <li>ā<strong>Custom allocators</strong> - if you want it.</li> <li>ā<strong>Custom error handling</strong> - if you want it.</li> <li>ā<strong>Safe functions</strong> warn the programmer about NULL values and unused return values. Can be configured to not compile if not Secure. Optional null-check macros in every library function. Does not use any of <code>"gets", "fgets", "strcpy", "strcat", "sprintf", "vsprintf", "scanf", "fscanf", "system", "chown", "chmod", "chgrp", "alloca", "execl", "execle", "execlp", "execv", "execve", "execvp", "bcopy", "bzero"</code>. You can configure it to never use any unsafe functions.</li> <li>ā<strong>Portable</strong> - works on all platforms, using platform specific features (using #ifdefs) to make functions better and faster.</li> <li>ā<strong>Multithreading support</strong> (optional), with list_comprehension_multithreaded (accepts any number of threads, works in parallel using portable C11 threads)</li> <li>ā<strong>Networking support</strong> (optional), using libcurl - making it extremely easy to download websites and arrays of websites - features other languages do not have.</li> <li>āVery good and thorough <strong>Error Handling</strong> and <strong>allocation overflow</strong> checking (good for <strong>Security and Robustness</strong>) in the functions. Allows the programmer to dynamically choose to catch all errors in the functions with a handler (default or custom), or to ignore them. No need to ALWAYS say "if (.....) if you don't want to. Can be changed at runtime.</li> <li>ā<strong>Public Domain</strong> so you make the code how you want. (No need to "propitiate" to some "god" of some library).</li> <li>ā<strong>Minimal abstractions or indirection of any kind or needless slow things that complicate things</strong> - macros, namespace collision, typedefs, structs, object-orientation messes, slow compilation times, bloat, etc., etc.</li> <li>ā<strong>No namespace pollution</strong> - you can generate your <span style=font-style:normal;><b>own version</b></span> with any prefix you like!</li> <li>ā<strong>Relies <span style=font-style:normal;>minimally</span> on C libraries - it can be fully decoupled from LIB C and can be statically linked.</strong></li> <li>ā<span style=font-style:normal;><b>Very small</b></span> - 13K Lines of Code (including Doxygen comments and following of Best Practices)</li> <li>ā<strong>No Linkage Issues or dependency hell</strong></li> <li>ā<strong>Thorough and clear documentation</strong>, with examples of usage.</li> <li>ā<strong>No licensing restrictions whatsoever - use it for your engineering project, your startup, your Fortune 500 company, your personal project, your throw-away script, your government.</strong></li> <li>ā<strong>Makes C like Python or Perl or Ruby in many ways - or more easy</strong></li> <li>ā<strong>Easy Straightforward Transpilation Support</strong> - to make current code, much faster - all without any bloat (See transpile_slow_scripting_into_c.rb). <li><h4>In many cases, there is now a direct mapping of functions from other languages into optimized C. See the example script in this repository. This makes optimizing your Python / Perl / Ruby / PHP etc. script very easy, either manually or through the use of AI.</h4></li> </ul> </p> </div> <div class=pane style='border: 0;border-right: 1px dotted rgb(200, 200, 200); background-color: rgb(255, 255, 190);'> <div class="library-details"><h2 style=color:green;>Foundationallib Features</h2> <p class=feature> <strong>Functional Programming Features</strong> - <code>map, reduce, filter,</code> List Comprehensions in C and much more!</p> <p class=feature><strong>Expands C's Primitives for easy manipulation of data types</strong> such as Arrays, Strings, <code>Dict</code>, <code>Set</code>, <code>FrozenDict</code>, <code>FrozenSet</code> - <strong>and enables easy manipulation, modification, alteration, comparison, sorting, counting, IO (printing) and duplication of these at a very comfortable level</strong> - something very, very rare in C or C++, <i>all without any overhead.</i></p> <p class=feature><strong>More comfortable IO</strong> - read and write entire files with ease, and convert complex types into strings or print them on the screen with ease. </p> <p class=feature><strong>A powerful general purpose Foundational Library</strong> - <i>which has anything and everything you need</i> - from <code>replace_all()</code> to <code>replace_memory()</code> to <code>find_last_of()</code> to to <code>list_comprehension()</code> to <code>shellescape()</code> to <code>read_file_into_string()</code> to <code>string_to_json()</code> to <code>string_to_uppercase()</code> to <code>to_title_case()</code> to <code>read_file_into_array()</code> to <code>read_files_into_array()</code> to <code>map()</code> to <code>reduce()</code> to <code>filter()</code> to <code>list_comprehension_multithreaded()</code> to <code>frozen_dict_new_instance()</code> to <code>backticks()</code> - everything you would want to make quick and optimally efficient C programs, this has it.</p> <div style='height: 1px; border: 0;border-bottom: 1px dashed rgb(200, 200, 200);'></div> <p class=performance><span>Helps to make programs hundreds of times faster than other languages with similar ease of creation.</span> <hr> <p class=feature><strong>Easily take advantage of CPU cores with list_comprehension_multithreaded()</strong>.<br><br>You can specify the number of threads, the transform and the filter functions, and this will transform your data - all in parallel. Don't have a multithreaded environment? Then disable it (set the flag).</p> <hr> <h3>You don't want to be reinventing the wheel and hoping that your memory allocation is secure enough - and then failing. <strong>Security Is Paramount.</strong></h3> <h3>You don't want to be waiting <span style='color:rgb(240, 0, 0);'>a day</span> for an operation to complete when it could take <span style='color:rgb(30, 30, 255);'>less than an hour</span>.</h3> <br><p>This library is founded on very strong and unequivocal goals and philosophy. In fact, I have written many articles about the foundation of this library and more relevantly the broader context. See the Articles folder - for some of the foundation of this library.</p> <br><p>This library is an ideal and a dream - not just a Software Library. As such, I would highly suggest that you support me in this mission. Even if it's different from the status quo. Are you a Rust or Zig fan? Then make a Rust or Zig version of this ideal. Let's go. Give me an email.</p> </div> </div> <br> No Copyright - Public Domain - 2023, Gregory Cohen <gregorycohennew@gmail.com> DONATION REQUEST: If this free software has helped you and you find it valuable, please consider making a donation to support the ongoing development and maintenance of this project. Your contribution helps ensure the availability of this library to the community and encourages further improvements. Donations can be made at: https://www.paypal.com/paypalme/cfoundationallib Note: The best way to contact me is through email, not social media. Please feel very free to email me if you want to express feedback, suggest an improvement, desire to collaborate on this free and open source project, want to support me, or want to create something great. Complacency and obstructionism and whining are not tolerated. I desire to make this library the best theoretically possible, so please, let us connect. <pre><code> Mirror Links Blog - https://foundationallib.wordpress.com/ Github - https://github.com/gregoryc/foundationallib Ruby Gem Mirror - https://rubygems.org/gems/foundational_lib Ruby Gem Mirror - https://rubygems.org/gems/foundational_lib2 Library Instagram - https://www.instagram.com/foundationallib Google Drive Mirrors ZIP - https://drive.google.com/file/d/1bK2njCRsH4waTm4LP16sloPQawk7JIR5/view?usp=sharing TAR.GZ - https://drive.google.com/file/d/1RCA1yy9R3cEqI_X9Lv0fxqh-zgNCK005/view?usp=sharing TAR.BZ2 - https://drive.google.com/file/d/1ljdlI_fEnMS_X5WmuhI1qavhgseWlD5j/view?usp=sharing </code></pre> <h1>This code is in the public domain, fully. You can do whatever you want with it. See docs.html for API reference.  </h1> <h1>Here's some examples of some things you can do easily with Foundationallib.<br><br> <h3>Use it for scripting purposes...</h3> </h1>  <h1>Take control of the Web - in C.<br><br></h1> 