repo
stringlengths
5
92
file_url
stringlengths
80
287
file_path
stringlengths
5
197
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:37:27
2026-01-04 17:58:21
truncated
bool
2 classes
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/service/result/success.rb
lib/aldous/service/result/success.rb
require 'aldous/service/result/base' module Aldous class Service module Result class Success < ::Aldous::Service::Result::Base end end end end
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/service/result/base.rb
lib/aldous/service/result/base.rb
require 'aldous/simple_dto' require 'aldous/service/result/base/predicate_methods_for_inheritance' module Aldous class Service module Result class Base < ::Aldous::SimpleDto extend PredicateMethodsForInheritance end end end end
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/service/result/failure.rb
lib/aldous/service/result/failure.rb
require 'aldous/service/result/base' module Aldous class Service module Result class Failure < ::Aldous::Service::Result::Base end end end end
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/service/result/base/predicate_methods_for_inheritance.rb
lib/aldous/service/result/base/predicate_methods_for_inheritance.rb
require 'aldous/service/result/base' module Aldous class Service module Result class Base < ::Aldous::SimpleDto module PredicateMethodsForInheritance # For every child class, create a predicate method on the base named # after the child that returns false and override the same p...
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/errors/user_error.rb
lib/aldous/errors/user_error.rb
module Aldous module Errors class UserError < StandardError end end end
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/view/blank/json_view.rb
lib/aldous/view/blank/json_view.rb
require 'aldous/respondable/renderable' module Aldous module View module Blank class JsonView < Respondable::Renderable def template { json: {} } end end end end end
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/view/blank/html_view.rb
lib/aldous/view/blank/html_view.rb
require 'aldous/respondable/renderable' module Aldous module View module Blank class HtmlView < Respondable::Renderable def template { html: "", layout: true } end end end end end
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/view/blank/atom_view.rb
lib/aldous/view/blank/atom_view.rb
require 'aldous/respondable/renderable' module Aldous module View module Blank class AtomView < Respondable::Renderable def template end end end end end
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/respondable/send_data.rb
lib/aldous/respondable/send_data.rb
require 'aldous/respondable/base' module Aldous module Respondable class SendData < Base def action(controller) SendDataAction.new(data, options, controller, view_data) end def data raise Errors::UserError.new("SendData objects must define a 'data' method") end def...
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/respondable/redirectable.rb
lib/aldous/respondable/redirectable.rb
require 'aldous/respondable/base' require 'aldous/respondable/shared/flash' module Aldous module Respondable class Redirectable < Base def action(controller) RedirectAction.new(location, controller, view_data, status) end def location raise Errors::UserError.new("Redirectable o...
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/respondable/headable.rb
lib/aldous/respondable/headable.rb
require 'aldous/respondable/base' module Aldous module Respondable class Headable < Base def action(controller) HeadAction.new(controller, status) end def default_status :ok end private class HeadAction attr_reader :controller, :status def i...
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/respondable/renderable.rb
lib/aldous/respondable/renderable.rb
require 'aldous/respondable/base' require 'aldous/respondable/shared/flash' module Aldous module Respondable class Renderable < Base def action(controller) RenderAction.new(template, status, controller, view_data) end def default_status :ok end def default_template...
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/respondable/base.rb
lib/aldous/respondable/base.rb
require 'aldous/view_builder' require 'aldous/simple_dto' module Aldous module Respondable class Base attr_reader :view_data, :view_context def initialize(status, view_data, view_context, view_builder = nil) @status = status @view_data = view_data @view_context = view_context...
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/respondable/request_http_basic_authentication.rb
lib/aldous/respondable/request_http_basic_authentication.rb
module Aldous module Respondable class RequestHttpBasicAuthentication < Base def action(controller) RequestHttpBasicAuthenticationAction.new(controller) end private class RequestHttpBasicAuthenticationAction attr_reader :controller def initialize(controller) ...
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
envato-archive/aldous
https://github.com/envato-archive/aldous/blob/0eb0a18b511345ad5fea3072a7111ea5ebcfb30d/lib/aldous/respondable/shared/flash.rb
lib/aldous/respondable/shared/flash.rb
module Aldous module Respondable module Shared class Flash attr_reader :result, :flash_container def initialize(result, flash_container) @result = result @flash_container = flash_container end def set_error flash_container[:error] = error if er...
ruby
MIT
0eb0a18b511345ad5fea3072a7111ea5ebcfb30d
2026-01-04T17:54:58.048556Z
false
rweng/underscore-rails
https://github.com/rweng/underscore-rails/blob/5267dba35174120b096d36e5941a8e49b5c921a2/lib/underscore-rails.rb
lib/underscore-rails.rb
require "underscore-rails/version" module Underscore module Rails if defined?(::Rails) and Gem::Requirement.new('>= 3.1').satisfied_by?(Gem::Version.new ::Rails.version) class Rails::Engine < ::Rails::Engine # this class enables the asset pipeline end end end end
ruby
MIT
5267dba35174120b096d36e5941a8e49b5c921a2
2026-01-04T17:55:02.820262Z
false
rweng/underscore-rails
https://github.com/rweng/underscore-rails/blob/5267dba35174120b096d36e5941a8e49b5c921a2/lib/underscore-rails/version.rb
lib/underscore-rails/version.rb
module Underscore module Rails VERSION = "1.8.3" end end
ruby
MIT
5267dba35174120b096d36e5941a8e49b5c921a2
2026-01-04T17:55:02.820262Z
false
basecamp/fast_remote_cache
https://github.com/basecamp/fast_remote_cache/blob/6dc16b790ad3e5cc20b11e429f69b12e24e53cd1/init.rb
init.rb
# Include hook code here
ruby
MIT
6dc16b790ad3e5cc20b11e429f69b12e24e53cd1
2026-01-04T17:55:03.194780Z
false
basecamp/fast_remote_cache
https://github.com/basecamp/fast_remote_cache/blob/6dc16b790ad3e5cc20b11e429f69b12e24e53cd1/recipes/fast_remote_cache.rb
recipes/fast_remote_cache.rb
# --------------------------------------------------------------------------- # This is a recipe definition file for Capistrano. The tasks are documented # below. # --------------------------------------------------------------------------- # This file is distributed under the terms of the MIT license by 37signals, # L...
ruby
MIT
6dc16b790ad3e5cc20b11e429f69b12e24e53cd1
2026-01-04T17:55:03.194780Z
false
basecamp/fast_remote_cache
https://github.com/basecamp/fast_remote_cache/blob/6dc16b790ad3e5cc20b11e429f69b12e24e53cd1/lib/capistrano/recipes/deploy/strategy/fast_remote_cache.rb
lib/capistrano/recipes/deploy/strategy/fast_remote_cache.rb
# --------------------------------------------------------------------------- # This implements a specialization of the standard Capistrano RemoteCache # deployment strategy. The most significant difference between this strategy # and the RemoteCache is the way the cache is copied to the final release # directory: it u...
ruby
MIT
6dc16b790ad3e5cc20b11e429f69b12e24e53cd1
2026-01-04T17:55:03.194780Z
false
basecamp/fast_remote_cache
https://github.com/basecamp/fast_remote_cache/blob/6dc16b790ad3e5cc20b11e429f69b12e24e53cd1/lib/capistrano/recipes/deploy/strategy/utilities/copy.rb
lib/capistrano/recipes/deploy/strategy/utilities/copy.rb
# --------------------------------------------------------------------------- # A simple copy script for doing hard links and symbolic links instead of # explicit copies. Some OS's will already have a utility to do this, but # some won't; this file suffices in either case. # # Usage: ruby copy.rb <source> <target> <exc...
ruby
MIT
6dc16b790ad3e5cc20b11e429f69b12e24e53cd1
2026-01-04T17:55:03.194780Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/spec/spec_helper.rb
spec/spec_helper.rb
# frozen_string_literal: true require 'rspec/its' require 'faker' require 'webmock/rspec' # require 'byebug' require 'saharspec' require 'simplecov' require 'coveralls' Coveralls.wear! SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new( [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Forma...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/spec/tlaw/endpoint_spec.rb
spec/tlaw/endpoint_spec.rb
# frozen_string_literal: true RSpec.describe TLAW::Endpoint do let(:parent_class) { class_double('TLAW::ApiPath', url_template: 'http://example.com/{x}', full_param_defs: [param(:x), param(:y)]) } let(:param_defs) { [param(:a), param(:b)] } let(:cls) { described_class .define(sy...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/spec/tlaw/api_path_spec.rb
spec/tlaw/api_path_spec.rb
# frozen_string_literal: true RSpec.describe TLAW::APIPath do let(:parent_cls) { class_double( 'TLAW::ApiPath', parent: nil, url_template: 'http://example.com/{x}', full_param_defs: [param(:x), param(:y)] ) } let(:parent) { instance_double('TLAW::APIPath', prepared_params: {x: 'x...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/spec/tlaw/param_spec.rb
spec/tlaw/param_spec.rb
# frozen_string_literal: true require 'tlaw/param' RSpec.describe TLAW::Param do describe '#initialize' do subject { described_class.new(**args) } context 'with minimal args' do let(:args) { {name: :x} } it { is_expected.to have_attributes( name: :x, field: :x, ...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/spec/tlaw/api_spec.rb
spec/tlaw/api_spec.rb
# frozen_string_literal: true RSpec.describe TLAW::API do let(:cls) { Class.new(described_class).tap { |cls| cls.setup(base_url: 'http://foo/{bar}') } } describe '.define' do subject(:cls) { Class.new(described_class) } before { cls.define do base 'http://foo/bar' endpoint :a ...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/spec/tlaw/response_processors_spec.rb
spec/tlaw/response_processors_spec.rb
# frozen_string_literal: true RSpec.describe TLAW::ResponseProcessors do # TODO: more thorough tests, these are obviously ad-hoc describe 'Generators.transform_nested' do context 'without nested key' do subject { described_class::Generators.transform_nested(:c) { |h| h[:d] = 5 } } its_call(a: 1, b...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/spec/tlaw/data_table_spec.rb
spec/tlaw/data_table_spec.rb
# frozen_string_literal: true module TLAW RSpec.describe DataTable do let(:data) { [ {a: 1, b: 'a', c: Date.parse('2016-01-01')}, {a: 2, b: 'b', c: Date.parse('2016-02-01'), d: 'dummy'}, {a: 3, b: 'c', c: Date.parse('2016-03-01')} ] } subject(:table) { described_class...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/spec/tlaw/namespace_spec.rb
spec/tlaw/namespace_spec.rb
# frozen_string_literal: true RSpec.describe TLAW::Namespace do let(:cls) { described_class.define( symbol: :ns, path: '/ns', children: [ep, ns] ).tap { |c| c.parent = parent_cls } } let(:parent_cls) { class_double('TLAW::APIPath', url_template: 'http://foo/bar') } let(:ns) { desc...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/spec/tlaw/dsl/namespace_builder_spec.rb
spec/tlaw/dsl/namespace_builder_spec.rb
# frozen_string_literal: true require 'tlaw/dsl/namespace_builder' RSpec.describe TLAW::DSL::NamespaceBuilder do let(:builder) { described_class.new(symbol: :foo) } describe '#endpoint' do subject { builder.endpoint(:foo, '/bar') { param :bar } } its_block { is_expected.to change(builder, :childre...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/spec/tlaw/dsl/base_builder_spec.rb
spec/tlaw/dsl/base_builder_spec.rb
# frozen_string_literal: true require 'tlaw/dsl/base_builder' RSpec.describe TLAW::DSL::BaseBuilder do let(:opts) { {} } let(:builder) { described_class.new(symbol: :foo, **opts) } describe '#initialize' do subject(:call) { ->(*params) { described_class.new(*params).definition } } its_call(symbol: :fo...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/spec/tlaw/dsl/api_builder_spec.rb
spec/tlaw/dsl/api_builder_spec.rb
# frozen_string_literal: true require 'tlaw/dsl/api_builder' RSpec.describe TLAW::DSL::ApiBuilder do describe '#finalize' do let(:api) { Class.new(TLAW::API) } let(:builder) { described_class.new(api) do base 'http://google.com' namespace :foo do endpoint :bar do e...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/spec/tlaw/dsl/endpoint_builder_spec.rb
spec/tlaw/dsl/endpoint_builder_spec.rb
# frozen_string_literal: true require 'tlaw/dsl/endpoint_builder' RSpec.describe TLAW::DSL::EndpointBuilder do describe '#finalize' do let(:builder) { described_class.new(symbol: :foo, path: '/bar/{baz}') do description 'Good description' param :foo, Integer param :quux end ...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/spec/tlaw/formatting/describe_spec.rb
spec/tlaw/formatting/describe_spec.rb
# frozen_string_literal: true require 'tlaw/formatting/describe' RSpec.describe TLAW::Formatting::Describe do describe '.endpoint_class' do let(:ep) { TLAW::DSL::EndpointBuilder.new(symbol: :foo, path: '/foo') { desc 'The description' docs 'http://example.com' param :a, Integer, k...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/open_weather_map.rb
examples/open_weather_map.rb
require 'geo/coord' module TLAW module Examples class OpenWeatherMap < TLAW::API define do desc %Q{ API for [OpenWeatherMap](http://openweathermap.org/). Only parts available for free are implemented (as only them could be tested). } docs 'http://openweathermap....
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/giphy_demo.rb
examples/giphy_demo.rb
#!/usr/bin/env ruby require_relative 'demo_base' require_relative 'giphy' giphy = TLAW::Examples::Giphy.new(api_key: ENV['GIPHY']) pp giphy.gifs.search('tardis') # => {"data"=> # #<TLAW::DataTable[type, id, slug, url, bitly_gif_url, bitly_url, embed_url, username, source, rating, content_url, source_tld, source_post...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/giphy.rb
examples/giphy.rb
require 'pp' $:.unshift 'lib' require 'tlaw' module TLAW module Examples class Giphy < TLAW::API define do desc %Q{ Wrapper for [Giphy](https://giphy.com/) GIF hosting service API. } docs 'https://developers.giphy.com/docs/' base 'http://api.giphy.com/v1' ...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/open_weather_map_demo.rb
examples/open_weather_map_demo.rb
#!/usr/bin/env ruby require_relative 'demo_base' require_relative 'open_weather_map' # This is demonstration of TLAW (The Last API Wrapper) library's behavior # and opinions. # # All of below functionality is created by this API wrapper definition: # TODO URL # OK, first thing is: all API wrappers created with TLAW, ...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/forecast_io_demo.rb
examples/forecast_io_demo.rb
#!/usr/bin/env ruby require_relative 'demo_base' require_relative 'forecast_io' # This wrapper demo demonstrates that even a simple (one call, several # params) API could benefit from TLAW by param types checking & # sky-level discoverability. p TLAW::Examples::ForecastIO # #<TLAW::Examples::ForecastIO: call-sequence...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/tmdb_demo.rb
examples/tmdb_demo.rb
#!/usr/bin/env ruby require_relative 'demo_base' # This example demonstrates how TLAW allows you to define and redefine # API wrappers on the fly—to the extent you need and without much # bothering—and still have all the goodies. # For example, you have pretty large and complicated TheMoviesDatabase API: # http://doc...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/forecast_io.rb
examples/forecast_io.rb
module TLAW module Examples class ForecastIO < TLAW::API define do base 'https://api.forecast.io/forecast/{api_key}' desc %Q{ The Forecast API allows you to look up the weather anywhere on the globe, returning (where available): * Current conditions ...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/demo_base.rb
examples/demo_base.rb
$:.unshift File.expand_path('../../lib', __FILE__) require 'tlaw' require 'pp' begin require 'dotenv' Dotenv.load rescue LoadError end
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/urbandictionary_demo.rb
examples/urbandictionary_demo.rb
#!/usr/bin/env ruby require_relative 'demo_base' # That's an example of TLAW's strength. # # Urbandictionary API is really small (just two endpoints, only one of # which is actually useful, because /random is more like a joke). # # But you still need to remember the protocol, parse the answer and so # on. # # There is...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/open_route.rb
examples/experimental/open_route.rb
require_relative '../demo_base' require 'geo/coord' class OpenRouteService < TLAW::API define do base 'https://api.openrouteservice.org' param :api_key endpoint :directions do post_process { |res| res['route'] = res['routes'].first } param :coordinates, :to_a, keyword: false, ...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/bing_maps.rb
examples/experimental/bing_maps.rb
require_relative '../demo_base' #http://docs.themoviedb.apiary.io/#reference/movies/movielatest class BingMaps < TLAW::API define do base 'http://dev.virtualearth.net/REST/v1' param :key, required: true namespace :locations, '/Locations' do endpoint :query, '?q={q}' end end end maps = Bing...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/quandl.rb
examples/experimental/quandl.rb
require 'pp' $:.unshift 'lib' require 'tlaw' # https://www.quandl.com/docs/api?json#get-data class Quandl < TLAW::API define do base 'https://www.quandl.com/api/v3' param :api_key, required: true namespace :databases do endpoint :list, path: '.json' do param :per_page, :to_i end ...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/airvisual.rb
examples/experimental/airvisual.rb
require_relative '../demo_base' class AirVisual < TLAW::API define do base 'http://api.airvisual.com/v1' param :key, required: true endpoint :nearest, '/nearest?lat={latitude}&lon={longitude}' do end end end av = AirVisual.new(key: ENV['AIRVISUAL']) pp av.nearest(50.004444, 36.231389)
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/tmdb.rb
examples/experimental/tmdb.rb
require 'pp' $:.unshift 'lib' require 'tlaw' #http://docs.themoviedb.apiary.io/#reference/movies/movielatest class TMDB < TLAW::API define do base 'http://api.themoviedb.org/3' param :api_key, required: true param :language, default: 'en' namespace :movies, '/movie' do namespace :[], '/{id}'...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/apixu.rb
examples/experimental/apixu.rb
require_relative '../demo_base' class APIXU < TLAW::API define do docs 'https://www.apixu.com/doc/' base 'http://api.apixu.com/v1' param :key, required: true param :lang namespace :current, '/current.json' do endpoint :city, '?q={city}' do param :city, :to_s, required: true ...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/wunderground.rb
examples/experimental/wunderground.rb
module TLAW module Examples class WUnderground < TLAW::API define do base 'http://api.wunderground.com/api/{api_key}{/features}{/lang}/q' param :api_key, required: true param :lang, format: 'lang:#%s'.method(:%) FEATURES = %i[ alerts almanac as...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/open_exchange_rates.rb
examples/experimental/open_exchange_rates.rb
require_relative '../demo_base' class OpenExchangeRate < TLAW::API define do base 'https://openexchangerates.org/api' param :app_id, required: true post_process { |h| h['rates'] = h .select { |k, v| k.start_with?('rates.') } .map { |k, v| {'to' => k.sub('rates.', ''), 'rate' => v...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/reddit.rb
examples/experimental/reddit.rb
require 'pp' $:.unshift 'lib' require 'tlaw' class Reddit < TLAW::API define do base 'https://www.reddit.com' post_process_items 'data.children' do post_process("data.permalink") { |v| "https://www.reddit.com#{v}" } post_process("data.created", &Time.method(:at)) end namespace :r, '/r/...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/omdb.rb
examples/experimental/omdb.rb
require_relative '../demo_base' #http://docs.themoviedb.apiary.io/#reference/movies/movielatest class OMDB < TLAW::API define do base 'http://www.omdbapi.com' param :api_key, field: :apikey, required: true SPLIT = ->(v) { v.split(/\s*,\s*/) } shared_def :imdb do post_process('imdbRating', &:t...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/world_bank_climate.rb
examples/experimental/world_bank_climate.rb
require 'pp' $:.unshift 'lib' require 'tlaw' class WorldBankClimate < TLAW::API define do base 'http://climatedataapi.worldbank.org/climateweb/rest/v1' { basin: :basinID, country: :country_iso3 }.each do |namespace_name, param_name| namespace namespace_name do param param_name...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/swapi.rb
examples/experimental/swapi.rb
require 'pp' $:.unshift 'lib' require 'tlaw' class SWAPI < TLAW::API define do base 'http://swapi.co/api' namespace :people do endpoint :all, '' endpoint :[], '/{id}/' endpoint :search, '/?search={query}' end namespace :species do endpoint :all, '' endpoint :[], '/{id...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/musicbrainz.rb
examples/experimental/musicbrainz.rb
require 'pp' $:.unshift 'lib' require 'tlaw' class MusicBrainz < TLAW::API define do base 'http://musicbrainz.org/ws/2' endpoint :area, '/area/{id}?fmt=json' namespace :artist do endpoint :area, '?area={area_id}&fmt=json' endpoint :get, '/{id}?fmt=json' do param :inc, :to_a, format...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/currencylayer.rb
examples/experimental/currencylayer.rb
require_relative '../demo_base' class CurrencyLayer < TLAW::API define do base 'http://apilayer.net/api/' param :access_key, required: true endpoint :live do param :currencies, Array end endpoint :historical do param :date, :to_date, required: :true, keyword: false, format: ->(d) {...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/freegeoip.rb
examples/experimental/freegeoip.rb
require 'pp' $:.unshift 'lib' require 'tlaw' class FreeGeoIP < TLAW::API define do base 'http://freegeoip.net/json/' endpoint :here, '' endpoint :at, '/{ip}' end end fgi = FreeGeoIP.new pp fgi.here
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/isfdb.rb
examples/experimental/isfdb.rb
require 'pp' $:.unshift 'lib' require 'tlaw' class ISFDB < TLAW::API define do base 'http://www.isfdb.org/cgi-bin/rest' endpoint :isbn, '/getpub.cgi?{isbn}', xml: true end end i = ISFDB.new #pp i.isbn('0399137378')["ISFDB.Publications.Publication"].last pp i.isbn('038533348X')["ISFDB.Publications.Publi...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/earthquake.rb
examples/experimental/earthquake.rb
require 'pp' $:.unshift 'lib' require 'tlaw' class Earthquake < TLAW::API define do base 'http://earthquake.usgs.gov/fdsnws/event/1' endpoint :count, '/count?format=geojson' do param :starttime, Date, format: ->(d) { d.strftime('%Y-%m-%d') } param :endtime, Date, format: ->(d) { d.strftime('%Y-...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/wunderground_demo.rb
examples/experimental/wunderground_demo.rb
#!/usr/bin/env ruby require_relative '../demo_base' require_relative 'wunderground' weather = TLAW::Examples::WUnderground.new(api_key: ENV['WUNDERGROUND']) pp weather.city('Kharkiv', 'Ukraine', features: %i[astronomy tide])
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/open_street_map.rb
examples/experimental/open_street_map.rb
require 'pp' $:.unshift 'lib' require 'tlaw' class OpenStreetMap < TLAW::API define do base 'http://api.openstreetmap.org/api/0.6' endpoint :relation, '/relation/{id}', xml: true end end osm = OpenStreetMap.new pp osm.relation(1543125)["osm.relation.tag"].to_a
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/nominatim.rb
examples/experimental/nominatim.rb
require 'pp' $:.unshift 'lib' require 'tlaw' class Nominatim < TLAW::API define do base 'http://nominatim.openstreetmap.org' param :lang, field: 'accept%2Dlanguage' namespace :search, '/search?format=json' do endpoint :query, '' do param :query, field: :q, keyword: false param :...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/world_bank.rb
examples/experimental/world_bank.rb
require 'pp' $:.unshift 'lib' require 'tlaw' class WorldBank < TLAW::API define do base 'http://api.worldbank.org' post_process_replace { |response| if response.is_a?(Array) && response.size == 1 && response.first.is_a?(Hash) response.first elsif response.is_a?(Array) && response.size =...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/afterthedeadline.rb
examples/experimental/afterthedeadline.rb
require 'pp' $:.unshift 'lib' require 'tlaw' #http://docs.themoviedb.apiary.io/#reference/movies/movielatest class AfterTheDeadline < TLAW::API define do base 'http://service.afterthedeadline.com' param :key, required: true endpoint :document, '/checkDocument', xml: true do param :data, keyword...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/examples/experimental/geonames.rb
examples/experimental/geonames.rb
require_relative '../demo_base' require 'geo/coord' #http://www.geonames.org/export/web-services.html #http://www.geonames.org/export/credits.html #http://www.geonames.org/export/ws-overview.html class GeoNames < TLAW::API define do base 'http://api.geonames.org' param :username, required: true param :...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw.rb
lib/tlaw.rb
# frozen_string_literal: true require 'json' require 'backports/2.4.0/string/match' require 'backports/2.4.0/hash/compact' require 'backports/2.4.0/hash/transform_values' require 'backports/2.5.0/kernel/yield_self' require 'backports/2.5.0/hash/transform_keys' require 'backports/2.5.0/enumerable/all' require 'addre...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/response_processors.rb
lib/tlaw/response_processors.rb
# frozen_string_literal: true module TLAW # @private module ResponseProcessors # @private module Generators module_function def mutate(&block) proc { |hash| hash.tap(&block) } end def transform_by_key(key_pattern, &block) proc { |hash| ResponseProcessors.transform_...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/version.rb
lib/tlaw/version.rb
# frozen_string_literal: true module TLAW MAJOR = 0 MINOR = 1 PATCH = 0 PRE = 'pre' VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.') end
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/namespace.rb
lib/tlaw/namespace.rb
# frozen_string_literal: true module TLAW # Namespace is a grouping tool for API endpoints. # # Assuming we have this API definition: # # ```ruby # class OpenWeatherMap < TLAW::API # define do # base 'http://api.openweathermap.org/data/2.5' # # namespace :current, '/weather' do # ...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/formatting.rb
lib/tlaw/formatting.rb
# frozen_string_literal: true module TLAW # Just a bit of formatting utils. module Formatting # Description is just a String subclass with rewritten `inspect` # implementation (useful in `irb`/`pry`): # # ```ruby # str = "Description of endpoint:\nIt has params:..." # # "Description of endp...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/param.rb
lib/tlaw/param.rb
# frozen_string_literal: true require_relative 'param/type' module TLAW # @private class Param attr_reader :name, :field, :type, :description, :default, :format def initialize( name:, field: name, type: nil, description: nil, required: false, keyword: true, defau...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/api.rb
lib/tlaw/api.rb
# frozen_string_literal: true module TLAW # API is a main TLAW class (and the only one you need to use directly). # # Basically, you start creating your definition by descending from API and defining namespaces and # endpoints through a {DSL} like this: # # ```ruby # class SomeImagesAPI < TLAW::API # ...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/dsl.rb
lib/tlaw/dsl.rb
# frozen_string_literal: true module TLAW # This module is core of a TLAW API definition. It works like this: # # ```ruby # class MyAPI < TLAW::API # define do # here starts what DSL does # namespace :ns do # # endpoint :es do # param :param1, Integer, default: 1 # end #...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/api_path.rb
lib/tlaw/api_path.rb
# frozen_string_literal: true require 'forwardable' module TLAW # Base class for all API pathes: entire API, namespaces and endpoints. # Allows to define params and post-processors on any level. # class APIPath class << self # @private attr_reader :symbol, :parent, :path, :param_defs, :descrip...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/data_table.rb
lib/tlaw/data_table.rb
# frozen_string_literal: true module TLAW # Basically, just a 2-d array with column names. Or you can think of # it as an array of hashes. Or loose DataFrame implementation. # # Just like this: # # ```ruby # tbl = DataTable.new([ # {id: 1, name: 'Mike', salary: 1000}, # {id: 2, name: 'Doris', sal...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/endpoint.rb
lib/tlaw/endpoint.rb
# frozen_string_literal: true require 'faraday' require 'faraday_middleware' require 'addressable/template' require 'crack' module TLAW # Represents API endpoint. # # You will neither create nor use endpoint descendants or instances directly: # # * endpoint class definition is performed through {DSL} helper...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/util.rb
lib/tlaw/util.rb
# frozen_string_literal: true module TLAW # @private module Util module_function def camelize(string) string.sub(/^[a-z\d]*/, &:capitalize) end def deindent(string) string .gsub(/^[ \t]+/, '') # first, remove spaces at a beginning of each line .gsub(/\A\n|\n\s*\Z/...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/dsl/namespace_builder.rb
lib/tlaw/dsl/namespace_builder.rb
# frozen_string_literal: true require_relative 'base_builder' require_relative 'endpoint_builder' module TLAW module DSL # @private class NamespaceBuilder < BaseBuilder CHILD_CLASSES = {NamespaceBuilder => Namespace, EndpointBuilder => Endpoint}.freeze attr_reader :children ENDPOINT_METH...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/dsl/api_builder.rb
lib/tlaw/dsl/api_builder.rb
# frozen_string_literal: true require_relative 'base_builder' require_relative 'endpoint_builder' require_relative 'namespace_builder' module TLAW module DSL # @private class ApiBuilder < NamespaceBuilder # @private CLASS_NAMES = { :[] => 'Element' }.freeze def initialize(ap...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/dsl/endpoint_builder.rb
lib/tlaw/dsl/endpoint_builder.rb
# frozen_string_literal: true require_relative 'base_builder' module TLAW module DSL # @private class EndpointBuilder < BaseBuilder def definition # TODO: Here we'll be more flexible in future, allowing to avoid flatten/datablize all_processors = [ @parser, Response...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/dsl/base_builder.rb
lib/tlaw/dsl/base_builder.rb
# frozen_string_literal: true module TLAW module DSL # @private class BaseBuilder attr_reader :params, :processors, :shared_definitions def initialize(symbol:, path: nil, context: nil, xml: false, params: {}, **opts, &block) path ||= "/#{symbol}" # Not default arg, because we need to pro...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/formatting/inspect.rb
lib/tlaw/formatting/inspect.rb
# frozen_string_literal: true module TLAW module Formatting # @private module Inspect class << self def endpoint(object) _object(object) end def namespace(object) _object(object, children_list(object.class)) end def endpoint_class(klass) ...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/formatting/describe.rb
lib/tlaw/formatting/describe.rb
# frozen_string_literal: true module TLAW module Formatting # @private module Describe class << self def endpoint_class(klass) [ Formatting.call_sequence(klass), klass.description&.yield_self { |desc| "\n" + indent(desc, ' ') }, klass.docs_link&.yi...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
molybdenum-99/tlaw
https://github.com/molybdenum-99/tlaw/blob/922ecb7994b91aafda56582d7a69e230d14a19db/lib/tlaw/param/type.rb
lib/tlaw/param/type.rb
# frozen_string_literal: true module TLAW class Param # @private class Type attr_reader :type def self.default_type @default_type ||= Type.new(nil) end def self.coerce(type = nil) case type when nil default_type when Type type ...
ruby
MIT
922ecb7994b91aafda56582d7a69e230d14a19db
2026-01-04T17:55:02.922765Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/app/app_delegate.rb
app/app_delegate.rb
class AppDelegate def application(application, didFinishLaunchingWithOptions:launchOptions) true end end
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/spec/operation_spec.rb
spec/operation_spec.rb
describe Elevate::ElevateOperation do before do @target = lambda { 42 } @operation = Elevate::ElevateOperation.alloc.initWithTarget(@target, args: {}, channel: []) @queue = NSOperationQueue.alloc.init end after do @queue.waitUntilAllOperationsAreFinished end describe "#exception" do desc...
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/spec/io_coordinator_spec.rb
spec/io_coordinator_spec.rb
describe Elevate::IOCoordinator do before do @coordinator = Elevate::IOCoordinator.new end it "is not cancelled" do @coordinator.should.not.be.cancelled end describe "#install" do it "stores the coordinator in a thread-local variable" do @coordinator.install() Thread.current[:io_coo...
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/spec/elevate_spec.rb
spec/elevate_spec.rb
class TestController include Elevate def initialize @invocations = {} @counter = 0 @threads = [] @updates = [] @callback_args = nil @completion = nil end attr_accessor :started attr_accessor :result attr_accessor :exception attr_accessor :invocations attr_accessor :counter at...
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/spec/task_context_spec.rb
spec/task_context_spec.rb
describe Elevate::TaskContext do describe "#execute" do it "runs the specified block" do result = {} context = Elevate::TaskContext.new(->{ result[:ret] = true }, [], {}) context.execute result[:ret].should.be.true end end end
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/spec/http_spec.rb
spec/http_spec.rb
describe Elevate::HTTP do extend WebStub::SpecHelpers before { disable_network_access! } after { enable_network_access! } before do @url = "http://www.example.com/" end Elevate::HTTP::Request::METHODS.each do |m| describe ".#{m}" do it "synchronously issues a HTTP #{m} request" do ...
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/spec/http/request_spec.rb
spec/http/request_spec.rb
describe Elevate::HTTP::Request do extend WebStub::SpecHelpers before do disable_network_access! end before do @url = "http://www.example.com/" @body = "hello" end it "requires a valid HTTP method" do lambda { Elevate::HTTP::Request.new(:invalid, @url) }.should.raise(ArgumentError) end ...
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/spec/http/http_client_spec.rb
spec/http/http_client_spec.rb
describe Elevate::HTTP::HTTPClient do extend WebStub::SpecHelpers before do disable_network_access! @base_url = "http://www.example.com" @path = "/resource/action" @url = @base_url + @path @client = Elevate::HTTP::HTTPClient.new(@base_url) end it "issues requests to the complete URL" do ...
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/spec/http/activity_indicator_spec.rb
spec/http/activity_indicator_spec.rb
describe Elevate::HTTP::ActivityIndicator do before do UIApplication.sharedApplication.setNetworkActivityIndicatorVisible(false) @indicator = Elevate::HTTP::ActivityIndicator.new end describe ".instance" do it "returns a singleton instance" do instance = Elevate::HTTP::ActivityIndicator.instan...
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate.rb
lib/elevate.rb
require 'elevate/version' unless defined?(Motion::Project::Config) raise "This file must be required within a RubyMotion project Rakefile." end Motion::Project::App.setup do |app| Dir.glob(File.join(File.dirname(__FILE__), "elevate/**/*.rb")).each do |file| app.files.unshift(file) end end
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/task.rb
lib/elevate/task.rb
module Elevate class Task def initialize(definition, controller, active_tasks) @definition = definition @controller = WeakRef.new(controller) @active_tasks = active_tasks @operation = nil @channel = Channel.new(method(:on_update)) @args = nil @timer = nil end def...
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/version.rb
lib/elevate/version.rb
module Elevate VERSION = "0.7.0" end
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/task_definition.rb
lib/elevate/task_definition.rb
module Elevate class TaskDefinition def initialize(name, options, &block) @name = name @options = options @handlers = {} instance_eval(&block) end attr_reader :name attr_reader :handlers attr_reader :options def method_missing(method, *args, &block) if method.t...
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/channel.rb
lib/elevate/channel.rb
module Elevate # A simple unidirectional stream of data with a single consumer. # # @api private class Channel def initialize(block) @target = block end # Pushes data to consumers immediately # # @return [void] # # @api private def <<(obj) @target.call(obj) end ...
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false
mattgreen/elevate
https://github.com/mattgreen/elevate/blob/edb3e428c9643974cdf1a747ff961c09d771aec5/lib/elevate/future.rb
lib/elevate/future.rb
module Elevate class Future OUTSTANDING = 0 FULFILLED = 1 def initialize @lock = NSConditionLock.alloc.initWithCondition(OUTSTANDING) @value = nil end def fulfill(value) if @lock.tryLockWhenCondition(OUTSTANDING) @value = value @lock.unlockWithCondition(FULFILLE...
ruby
MIT
edb3e428c9643974cdf1a747ff961c09d771aec5
2026-01-04T17:55:16.391428Z
false