source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
socketry/sus
https://github.com/socketry/sus
lib/sus/assertions.rb
Ruby
mit
195
main
15,760
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2025, by Samuel Williams. require_relative "output" require_relative "clock" require_relative "output/backtrace" module Sus # Represents a collection of test assertions and their results. Tracks passed, failed, skipped, and errored a...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/include_context.rb
Ruby
mit
195
main
604
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require_relative "context" module Sus module Context # Include a shared context into the current context, along with any arguments or options. # # @parameter shared [Sus::Shared] The shared context to i...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/registry.rb
Ruby
mit
195
main
2,208
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. # Copyright, 2022, by Brad Schrag. require_relative "base" require_relative "file" require_relative "describe" require_relative "with" require_relative "it" require_relative "shared" require_relative "it_beh...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/mock.rb
Ruby
mit
195
main
5,082
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2022-2025, by Samuel Williams. require_relative "expect" module Sus # Represents a mock object that can intercept and replace method calls on a target object. class Mock # Initialize a new mock for the given target. # @parameter targe...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/with.rb
Ruby
mit
195
main
2,305
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require_relative "context" module Sus # Represents a test context with specific conditions or variables. module With extend Context # @attribute [String] The subject description of this context. att...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/raise_exception.rb
Ruby
mit
195
main
2,282
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. module Sus # Represents a predicate that checks if a block raises an exception. class RaiseException # Initialize a new RaiseException predicate. # @parameter exception_class [Class] The exception class t...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/receive.rb
Ruby
mit
195
main
9,073
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2022-2025, by Samuel Williams. require_relative "respond_to" module Sus # Represents an expectation that a method will be called on an object. class Receive # Initialize a new Receive expectation. # @parameter base [Object] The base o...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/output.rb
Ruby
mit
195
main
1,744
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require_relative "output/bar" require_relative "output/text" require_relative "output/xterm" require_relative "output/null" require_relative "output/progress" module Sus # Represents output handlers for test...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/be_within.rb
Ruby
mit
195
main
2,698
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. module Sus # Represents a predicate that checks if the subject is within a tolerance of a value. class BeWithin # Represents a bounded range check. class Bounded # Initialize a new bounded predicate. ...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/it.rb
Ruby
mit
195
main
4,139
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require_relative "context" module Sus # Represents an individual test case. module It # Build a new test case class. # @parameter parent [Class] The parent context class. # @parameter description [Stri...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/be_truthy.rb
Ruby
mit
195
main
1,532
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2022-2023, by Samuel Williams. module Sus # Represents a predicate that checks if the subject is truthy. module BeTruthy # Print a representation of this predicate. # @parameter output [Output] The output target. def self.print(outpu...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/describe.rb
Ruby
mit
195
main
1,785
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require_relative "context" module Sus # Represents a test group that describes a subject (class, module, or feature). module Describe extend Context # @attribute [Object] The subject being described. ...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/have_duration.rb
Ruby
mit
195
main
1,636
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. module Sus # Represents a predicate that measures the duration of a block execution. class HaveDuration # Initialize a new HaveDuration predicate. # @parameter predicate [Object] The predicate to apply to...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/identity.rb
Ruby
mit
195
main
5,279
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. module Sus # Represents a unique identity for a test or context, used for identification and location tracking. class Identity # Create an identity for a file. # @parameter parent [Identity, nil] The pare...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/config.rb
Ruby
mit
195
main
8,545
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2022-2025, by Samuel Williams. require_relative "clock" require_relative "registry" module Sus # Represents the configuration for running tests. class Config # The default path to the configuration file. PATH = "config/sus.rb" # ...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/shared.rb
Ruby
mit
195
main
1,404
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require_relative "context" module Sus # Represents a shared test context that can be reused across multiple test files. module Shared # @attribute [String] The name of the shared context. attr_accessor :...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/it_behaves_like.rb
Ruby
mit
195
main
2,128
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require_relative "context" module Sus # Represents a test context that behaves like a shared context. module ItBehavesLike extend Context # @attribute [Shared] The shared context being used. attr_ac...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/expect.rb
Ruby
mit
195
main
2,792
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. module Sus # Represents an expectation that can be used with predicates to make assertions. class Expect # Initialize a new Expect instance. # @parameter assertions [Assertions] The assertions instance to...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/base.rb
Ruby
mit
195
main
2,206
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require_relative "context" module Sus # Represents the base test case class. Provides core functionality for test execution including hooks for setup and teardown. class Base # Initialize a new test case i...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/be.rb
Ruby
mit
195
main
7,528
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. module Sus # Represents a predicate matcher that can be used with `expect(...).to be(...)`. class Be # Represents a logical AND combination of multiple predicates. class And # Initialize a new AND pred...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/filter.rb
Ruby
mit
195
main
2,902
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. module Sus # Provides a way to filter the registry according to the suffix on loaded paths. # # A test has an identity, e.g. the file and line number on which it's defined. # # A filter takes an identity, ...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/respond_to.rb
Ruby
mit
195
main
3,881
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2022-2025, by Samuel Williams. module Sus # Represents a predicate that checks if an object responds to a method. class RespondTo # Represents a constraint on method parameters. class WithParameters # Initialize a new WithParameters...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/have.rb
Ruby
mit
195
main
5,125
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2022-2024, by Samuel Williams. require_relative "have/all" require_relative "have/any" module Sus # Represents predicates for checking collections and object attributes. module Have # Represents a predicate that checks if a hash has a s...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/let.rb
Ruby
mit
195
main
676
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require_relative "context" module Sus module Context # Define a lazy variable that is evaluated when first accessed. # @parameter name [Symbol] The name of the variable. # @yields {...} The block that c...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/file.rb
Ruby
mit
195
main
4,389
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. # Copyright, 2022, by Brad Schrag. require_relative "context" # This has to be done at the top level. It allows us to define constants within the given class while still retaining top-level constant resolution...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/tree.rb
Ruby
mit
195
main
1,140
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2023, by Samuel Williams. module Sus # Represents a tree structure of test contexts. class Tree # Initialize a new Tree. # @parameter context [Object] The root context. def initialize(context) @context = context end # Trave...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/output/structured.rb
Ruby
mit
195
main
1,560
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2023-2024, by Samuel Williams. require_relative "null" module Sus module Output # Represents a structured JSON output handler for machine-readable output. class Structured < Null # Create a buffered structured output handler. # @...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/output/messages.rb
Ruby
mit
195
main
3,208
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2023-2025, by Samuel Williams. module Sus module Output # Provides message formatting methods for output handlers. module Messages # The prefix for passed assertions. PASSED_PREFIX = [:passed, "✓ "].freeze # The prefix for ...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/output/null.rb
Ruby
mit
195
main
1,256
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2025, by Samuel Williams. require_relative "messages" module Sus module Output # Represents a null output handler that discards all output. class Null include Messages # Initialize a new Null output handler. def initi...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/output/xterm.rb
Ruby
mit
195
main
1,690
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require "io/console" require_relative "text" module Sus module Output # Represents an XTerm-compatible output handler with color and style support. class XTerm < Text # Color codes for ANSI terminal c...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/output/bar.rb
Ruby
mit
195
main
2,614
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2022, by Samuel Williams. module Sus module Output # Represents a progress bar for displaying test execution progress. class Bar # Unicode block characters for drawing the progress bar. BLOCK = [ " ", "▏", "▎", ...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/output/progress.rb
Ruby
mit
195
main
4,014
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require_relative "bar" require_relative "status" require_relative "lines" module Sus module Output # Represents a progress tracker for test execution. class Progress # Get the current monotonic time. ...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/output/status.rb
Ruby
mit
195
main
1,551
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. module Sus module Output # Represents a status indicator for test execution. class Status # Register status styling with an output handler. # @parameter output [Output] The output handler to register...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/output/text.rb
Ruby
mit
195
main
3,532
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require_relative "messages" require_relative "buffered" module Sus module Output # Represents a plain text output handler without color support. class Text include Messages # Initialize a new Te...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/output/lines.rb
Ruby
mit
195
main
1,903
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require "io/console" module Sus module Output # Represents a line buffer for managing multiple lines of output on a terminal. class Lines # Initialize a new Lines buffer. # @parameter output [Output...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/output/buffered.rb
Ruby
mit
195
main
3,159
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2021-2024, by Samuel Williams. require "io/console" require "stringio" module Sus module Output # Represents a buffered output handler that stores output operations for later replay. class Buffered # Initialize a new Buffered output...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/output/backtrace.rb
Ruby
mit
195
main
3,765
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2022-2024, by Samuel Williams. module Sus module Output # Represents a backtrace for displaying error locations. class Backtrace # Create a backtrace from the first caller location. # @parameter identity [Identity, nil] Optional i...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/have/any.rb
Ruby
mit
195
main
1,413
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2022, by Samuel Williams. module Sus module Have # Represents a predicate that checks if the subject matches any of the given predicates. class Any # Initialize a new Any predicate. # @parameter predicates [Array] The predicates t...
github
socketry/sus
https://github.com/socketry/sus
lib/sus/have/all.rb
Ruby
mit
195
main
1,125
# frozen_string_literal: true # Released under the MIT License. # Copyright, 2022, by Samuel Williams. module Sus module Have # Represents a predicate that checks if the subject matches all of the given predicates. class All # Initialize a new All predicate. # @parameter predicates [Array] The predicates t...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
weibo_2.gemspec
Ruby
mit
195
master
1,084
# -*- encoding: utf-8 -*- require File.expand_path('../lib/weibo_2/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["simsicon"] gem.email = ["simsicon@gmail.com"] gem.description = %q{WeioOAuth2 is a Ruby gem that provides a wrapper for interacting with sina weibo's v2 API, ...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2.rb
Ruby
mit
195
master
1,189
require "weibo_2/version" require "weibo_2/config" require "weibo_2/base" require "weibo_2/client" require "weibo_2/errors" require "weibo_2/access_token" require "weibo_2/api/v2/base" require "weibo_2/api/v2/statuses" require "weibo_2/api/v2/users" require "weibo_2/api/v2/comments" require "weibo_2/api/v2/friendships"...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/config.rb
Ruby
mit
195
master
438
module WeiboOAuth2 module Config def self.api_key=(val) @@api_key = val end def self.api_key @@api_key ||= nil end def self.api_secret=(val) @@api_secret = val end def self.api_secret @@api_secret ||= nil end def self.redirect_uri=(v...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/version.rb
Ruby
mit
195
master
321
module WeiboOAuth2 class Version MAJOR = 0 unless defined? MAJOR MINOR = 1 unless defined? MINOR PATCH = 7 unless defined? PATCH PRE = nil unless defined? PRE class << self # @return [String] def to_s [MAJOR, MINOR, PATCH, PRE].compact.join('.') end end end end
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/access_token.rb
Ruby
mit
195
master
428
module WeiboOAuth2 class AccessToken < OAuth2::AccessToken def validated? !!expires_at && !expired? end def expired? expires? && (expires_at < time_convertion(Time.now, '+08:00').to_i) end #Convert Time from a time zone to another time zone #'+08:00' or '-08:00' #re...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/errors.rb
Ruby
mit
195
master
330
module WeiboOAuth2 module Errors class WeiboError < StandardError attr_reader :data def initialize(data) @data = data super end end class GeneralError < WeiboError end class RateLimitedError < WeiboError end class UnauthorizedError < WeiboError end ...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/client.rb
Ruby
mit
195
master
4,124
require 'oauth2' module WeiboOAuth2 class Client < OAuth2::Client attr_accessor :access_token def initialize(client_id='', client_secret='', opts={}, &block) client_id = WeiboOAuth2::Config.api_key if client_id.empty? client_secret = WeiboOAuth2::Config.api_secret if client_secret.empty? ...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/strategy/auth_code.rb
Ruby
mit
195
master
412
module WeiboOAuth2 module Strategy class AuthCode < OAuth2::Strategy::AuthCode def get_token(code, params={}, opts={}) params = {'grant_type' => 'authorization_code', 'code' => code, 'redirect_uri' => WeiboOAuth2::Config.redirect_uri.to_s}.merge(client_params).m...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/trends.rb
Ruby
mit
195
master
1,083
module WeiboOAuth2 module Api module V2 class Trends < Base #read interfaces def trends(uid, opt={}) hashie get("trends.json", :params => {:uid => uid}.merge(opt)) end def is_follow(trend_name, opt={}) hashie get("trends/is_follow.json", ...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/location.rb
Ruby
mit
195
master
3,179
module WeiboOAuth2 module Api module V2 class Location < Base #read interfaces def base_get_map_image(opt={}) hashie get("location/base/get_map_image.json", :params => opt) end def geo_ip_to_geo(ip, opt={}) hashie get("location/geo/ip_to_...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/remind.rb
Ruby
mit
195
master
739
require 'rest_client' module WeiboOAuth2 module Api module V2 class Remind < Base #read interfaces #http://open.weibo.com/wiki/2/remind/unread_count #this interface is different, it has a different domain, and frequently changed, it should be usually called from ja...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/register.rb
Ruby
mit
195
master
316
module WeiboOAuth2 module Api module V2 class Register < Base #read interfaces def verify_nickname(nickname, opt={}) hashie get("register/verify_nickname.json", :params => {:nickname => CGI::escape(nickname)}.merge(opt)) end end end end end
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/statuses.rb
Ruby
mit
195
master
3,705
module WeiboOAuth2 module Api module V2 class Statuses < Base #read interfaces def public_timeline(opt={}) hashie get("statuses/public_timeline.json", :params => opt) end def friends_timeline(opt={}) hashie get("statuses/friends_timeline....
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/account.rb
Ruby
mit
195
master
768
module WeiboOAuth2 module Api module V2 class Account < Base #read interfaces def get_privacy(opt={}) hashie get("account/get_privacy.json", :params => opt) end def profile_school_list(opt={}) hashie get("account/profile/school_list.json", ...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/users.rb
Ruby
mit
195
master
709
module WeiboOAuth2 module Api module V2 class Users < Base def show(opt={}) hashie get("users/show.json", :params => opt) end def show_by_uid(uid) show({"uid" => uid.to_i}) end def show_by_screen_name(screen_name) ...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/notification.rb
Ruby
mit
195
master
282
module WeiboOAuth2 module Api module V2 class Notification < Base #read interfaces def send(uids, tpl_id, opt={}) hashie get("notification/send", :params => {:uids => uids, :tpl_id => tpl_id}.merge(opt)) end end end end end
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/common.rb
Ruby
mit
195
master
852
module WeiboOAuth2 module Api module V2 class Common < Base #read interfaces def code_to_location(codes, opt={}) hashie get("common/code_to_location", :params => {:codes => codes}.merge(opt)) end def get_city(province, opt={}) hashie get("common/s...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/suggestions.rb
Ruby
mit
195
master
1,554
module WeiboOAuth2 module Api module V2 class Suggestions < Base #read interfaces def users_hot(opt={}) hashie get("suggestions/users/hot.json", :params => opt) end def users_may_interested(opt={}) hashie get("suggestions/users/may_intere...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/short_url.rb
Ruby
mit
195
master
1,736
module WeiboOAuth2 module Api module V2 class ShortUrl < Base #read interfaces def shorten(url_long, opt={}) hashie get("short_url/shorten.json", :params => {:url_long => url_long}.merge(opt)) end def expand(url_short, opt={}) hashie get("short_ur...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/comments.rb
Ruby
mit
195
master
1,513
module WeiboOAuth2 module Api module V2 class Comments < Base #read interfaces def show(id, opt={}) hashie get("comments/show.json", :params => {:id => id}.merge(opt)) end def by_me(opt={}) hashie get("comments/by_me.json", :params => opt) ...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/favorites.rb
Ruby
mit
195
master
1,839
module WeiboOAuth2 module Api module V2 class Favorites < Base #read interfaces def favorites(opt={}) hashie get("favorites.json", :params => opt) end def ids(opt={}) hashie get("favorites/ids.json", :params => opt) end ...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/friendships.rb
Ruby
mit
195
master
1,994
module WeiboOAuth2 module Api module V2 class Friendships < Base #read interfaces def friends(opt={}) hashie get("friendships/friends.json", :params => opt) end def friends_in_common(uid, opt={}) hashie get("friendships/friends/in_c...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/place.rb
Ruby
mit
195
master
4,606
module WeiboOAuth2 module Api module V2 class Place < Base #read interfaces def public_timeline(opt={}) hashie get("place/public_timeline.json", :params => opt) end def friends_timeline(opt={}) hashie get("place/friends_timeline.json", :params => ...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/search.rb
Ruby
mit
195
master
1,288
module WeiboOAuth2 module Api module V2 class Search < Base #read interfaces def suggestions_users(q, opt={}) hashie get("search/suggestions/users.json", :params => {:q => CGI::escape(q)}.merge(opt)) end def suggestions_statuses(q, opt={}) ...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/base.rb
Ruby
mit
195
master
2,399
require 'hashie' require 'json' require 'net/http/post/multipart' module WeiboOAuth2 module Api module V2 class Base extend Forwardable def_delegators :@access_token, :get, :post, :put, :delete @@API_VERSION = 2 def initialize(access_token) ...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
lib/weibo_2/api/v2/tags.rb
Ruby
mit
195
master
968
module WeiboOAuth2 module Api module V2 class Tags < Base #read interfaces def tags(uid, opt={}) hashie get("tags.json", :params => {:uid => uid}.merge(opt)) end def tags_batch(uids, opt={}) hashie get("tags/tags_batch.json", :params => {...
github
simsicon/weibo_2
https://github.com/simsicon/weibo_2
spec/client_spec.rb
Ruby
mit
195
master
1,643
require 'weibo_2' WeiboOAuth2::Config.api_key = 'abc' WeiboOAuth2::Config.api_secret = 'def' WeiboOAuth2::Config.redirect_uri = 'https://example.com/callback' describe WeiboOAuth2::Client do it 'should assign id and secret from config' do subject.id.should == 'abc' subject.secret.should == 'def' end it...
github
nebulab/erb-formatter
https://github.com/nebulab/erb-formatter
erb-formatter.gemspec
Ruby
mit
195
main
1,337
# frozen_string_literal: true require_relative "lib/erb/formatter/version" Gem::Specification.new do |spec| spec.name = "erb-formatter" spec.version = ERB::Formatter::VERSION spec.authors = ["Elia Schito"] spec.email = ["elia@schito.me"] spec.summary = "Format ERB files with speed and precision." spec.ho...
github
nebulab/erb-formatter
https://github.com/nebulab/erb-formatter
lib/erb/formatter.rb
Ruby
mit
195
main
12,687
# frozen_string_literal: false require 'pp' require 'erb' require 'yaml' require 'strscan' require 'stringio' require 'securerandom' require 'erb/formatter/version' require 'syntax_tree' require 'syntax_tree/plugin/trailing_comma' class ERB::Formatter module SyntaxTreeCommandPatch def format(q) q.group d...
github
nebulab/erb-formatter
https://github.com/nebulab/erb-formatter
lib/erb/formatter/command_line.rb
Ruby
mit
195
main
3,516
require 'erb/formatter' require 'optparse' class ERB::Formatter::CommandLine def self.tailwindcss_class_sorter(css_path) css = File.read(css_path) css = css.tr("\n", " ").gsub(%r{\/\*.*?\*\/},"") # remove comments css = css.gsub(%r<@media.*?\{>, "") # strip media queries css = css.scan(%r<(?:^|\}|\{...
github
nebulab/erb-formatter
https://github.com/nebulab/erb-formatter
lib/erb/formatter/ignore_list.rb
Ruby
mit
195
main
470
class ERB::Formatter::IgnoreList def initialize(contents: nil, base_dir: Dir.pwd) ignore_list_path = "#{base_dir}/.format-erb-ignore" @contents = contents || (File.exist?(ignore_list_path) ? File.read(ignore_list_path) : '') @ignore_list = @contents.lines end def should_ignore_file?(path) path = ...
github
nebulab/erb-formatter
https://github.com/nebulab/erb-formatter
test/erb/test_formatter.rb
Ruby
mit
195
main
8,417
# frozen_string_literal: true require "test_helper" class ERB::TestFormatter < Minitest::Test def test_that_it_has_a_version_number refute_nil ::ERB::Formatter::VERSION end def test_simple_tag assert_equal("<div>\n asdf\n</div>\n", ERB::Formatter.format("<div > asdf </div>")) end def te...
github
bizz84/Sustainable-Earth
https://github.com/bizz84/Sustainable-Earth
Dangerfile
Ruby
mit
195
master
888
# Ensure there is a summary for a pull request fail 'Please provide a summary in the Pull Request description' if github.pr_body.length < 5 # Warn when there are merge commits in the diff warn 'Please rebase to get rid of the merge commits in this Pull Request' if git.commits.any? { |c| c.message =~ /^Merge branch 'ma...
github
Aesthetikx/openai_pipe
https://github.com/Aesthetikx/openai_pipe
openai_pipe.gemspec
Ruby
mit
195
master
1,478
# frozen_string_literal: true require_relative "lib/openai_pipe/version" Gem::Specification.new do |spec| spec.name = "openai_pipe" spec.version = OpenAIPipe::VERSION spec.authors = ["John DeSilva"] spec.email = ["desilvjo@umich.edu"] spec.summary = "A UNIX-ey interface to OpenAI" spec.description = "Pro...
github
Aesthetikx/openai_pipe
https://github.com/Aesthetikx/openai_pipe
lib/openai_pipe.rb
Ruby
mit
195
master
444
# frozen_string_literal: true require_relative "openai_pipe/version" require "quick_openai" module OpenAIPipe class Error < StandardError; end def self.exe input_from_pipe = $stdin.read if $stdin.stat.pipe? input_from_arguments = ARGV.join(" ") if ARGV.any? prompt = [input_from_arguments, input_fr...
github
Aesthetikx/openai_pipe
https://github.com/Aesthetikx/openai_pipe
spec/spec_helper.rb
Ruby
mit
195
master
374
# frozen_string_literal: true require "openai_pipe" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_patching! config.expec...
github
Aesthetikx/openai_pipe
https://github.com/Aesthetikx/openai_pipe
spec/openai_pipe_spec.rb
Ruby
mit
195
master
215
# frozen_string_literal: true RSpec.describe OpenAIPipe do it "has a version number" do expect(OpenAIPipe::VERSION).not_to be nil end it "does something useful" do expect(true).to eq(true) end end
github
Casecommons/with_model
https://github.com/Casecommons/with_model
Gemfile
Ruby
mit
195
master
636
# frozen_string_literal: true source "https://rubygems.org" gemspec ar_branch = ENV.fetch("ACTIVE_RECORD_BRANCH", nil) ar_version = ENV.fetch("ACTIVE_RECORD_VERSION", nil) if ar_branch gem "activerecord", git: "https://github.com/rails/rails.git", branch: ar_branch gem "arel", git: "https://github.com/rails/are...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
Rakefile
Ruby
mit
195
master
257
# frozen_string_literal: true require "bundler/gem_tasks" require "rspec/core/rake_task" RSpec::Core::RakeTask.new require "minitest/test_task" Minitest::TestTask.create # standard rake task require "standard/rake" task default: %i[spec test standard]
github
Casecommons/with_model
https://github.com/Casecommons/with_model
with_model.gemspec
Ruby
mit
195
master
862
# frozen_string_literal: true $LOAD_PATH.push File.expand_path("lib", __dir__) require "with_model/version" Gem::Specification.new do |spec| spec.name = "with_model" spec.version = WithModel::VERSION spec.authors = ["Case Commons, LLC", "Grant Hutchins", "Andrew Marshall"] spec.email = %w[casecommons-dev@goog...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
test/test_helper.rb
Ruby
mit
195
master
479
# frozen_string_literal: true $LOAD_PATH.unshift File.expand_path("../lib", __dir__) require "with_model" require "minitest/autorun" WithModel.runner = :minitest Minitest::Test.class_eval do extend WithModel end # WithModel requires ActiveRecord::Base.connection to be established. # If ActiveRecord already has a...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
test/with_model_test.rb
Ruby
mit
195
master
853
# frozen_string_literal: true require "test_helper" class WithModelTest < Minitest::Test with_model :BlogPost do table do |t| t.string "title" t.text "content" t.timestamps null: false end model do def fancy_title "Title: #{title}" end end end def test_it_...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
lib/with_model.rb
Ruby
mit
195
master
2,290
# frozen_string_literal: true require "with_model/model" require "with_model/model/dsl" require "with_model/table" require "with_model/version" module WithModel class MiniTestLifeCycle < Module def initialize(object) define_method :before_setup do object.create super() if defined?(super) ...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
lib/with_model/constant_stubber.rb
Ruby
mit
195
master
1,065
# frozen_string_literal: true module WithModel class ConstantStubber def initialize(const_name) @const_name = const_name.to_sym @namespace = nil @original_value = nil end def stub_const(value) @namespace = namespace if @namespace.const_defined?(basename) @original_v...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
lib/with_model/model.rb
Ruby
mit
195
master
2,218
# frozen_string_literal: true require "logger" require "active_record" require "active_support/core_ext/string/inflections" require "English" require "with_model/constant_stubber" require "with_model/descendants_tracker" require "with_model/methods" require "with_model/table" module WithModel # In general, direct u...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
lib/with_model/descendants_tracker.rb
Ruby
mit
195
master
2,258
require "active_support/descendants_tracker" module WithModel # Based on https://github.com/rails/rails/blob/491afff27e2dd3d5f301b478b9a43d3c31709af8/activesupport/lib/active_support/descendants_tracker.rb module DescendantsTracker if RUBY_ENGINE == "ruby" # On MRI `ObjectSpace::WeakMap` keys are weak re...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
lib/with_model/table.rb
Ruby
mit
195
master
1,346
# frozen_string_literal: true require "active_record" module WithModel # In general, direct use of this class should be avoided. Instead use # either the {WithModel high-level API} or {WithModel::Model::DSL low-level API}. class Table # @param [Symbol] name The name of the table to create. # @param opti...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
lib/with_model/methods.rb
Ruby
mit
195
master
314
# frozen_string_literal: true module WithModel # Extended into all ActiveRecord models created by with_model. module Methods # Since model classes not created by with_model won't have this # method, one should instead test `respond_to?(:with_model?)`. def with_model? true end end end
github
Casecommons/with_model
https://github.com/Casecommons/with_model
lib/with_model/model/dsl.rb
Ruby
mit
195
master
751
# frozen_string_literal: true module WithModel class Model class DSL # @param model [WithModel::Model] The Model to mutate via this DSL. def initialize(model) @model = model end # Provide a schema definition for the table, passed to ActiveRecord's `create_table`. # The tabl...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
spec/active_record_behaviors_spec.rb
Ruby
mit
195
master
3,279
# frozen_string_literal: true require "spec_helper" describe "ActiveRecord behaviors" do describe "a temporary ActiveRecord model created with with_model" do context "that has a named scope" do before do @regular_model = Class.new ActiveRecord::Base do self.table_name = "regular_models" ...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
spec/readme_spec.rb
Ruby
mit
195
master
2,534
# frozen_string_literal: true require "spec_helper" describe "A blog post" do before do stub_const("MyModule", Module.new) end with_model :BlogPost do # The table block works just like a migration. table do |t| t.string :title t.timestamps null: false end # The model block work...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
spec/descendants_tracking_spec.rb
Ruby
mit
195
master
1,421
# frozen_string_literal: true require "spec_helper" describe "Descendants tracking" do with_model :BlogPost do model do def self.inspect "BlogPost class #{object_id}" end end end def blog_post_classes ActiveRecord::Base.descendants.select do |c| c.table_name == BlogPost.ta...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
spec/constant_stubber_spec.rb
Ruby
mit
195
master
482
# frozen_string_literal: true require "spec_helper" module WithModel describe ConstantStubber do it "allows calling unstub_const multiple times" do stubber = described_class.new("Foo") stubber.stub_const(1) expect { 2.times { stubber.unstub_const } }.not_to raise_error end it "allows ...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
spec/spec_helper.rb
Ruby
mit
195
master
978
# frozen_string_literal: true require "bundler/setup" require "with_model" RSpec.configure do |config| config.extend WithModel config.warnings = true config.expect_with :rspec do |c| c.syntax = :expect end config.mock_with :rspec do |c| c.syntax = :expect end end # WithModel requires ActiveRec...
github
Casecommons/with_model
https://github.com/Casecommons/with_model
spec/with_model_spec.rb
Ruby
mit
195
master
9,158
# frozen_string_literal: true require "active_model" require "spec_helper" shared_examples_for "ActiveModel" do require "active_model/lint" include SpecHelper::RailsTestCompatibility include ActiveModel::Lint::Tests active_model_methods = ActiveModel::Lint::Tests.public_instance_methods active_model_lint_t...
github
airbnb/lottie-spm
https://github.com/airbnb/lottie-spm
Rakefile
Ruby
apache-2.0
195
main
3,543
namespace :build do desc 'Builds the Lottie example app' namespace :example do desc 'Builds the Example apps for all supported platforms / architectures. Requires valid code signing.' task all: ['iOS:simulator', 'iOS:device', 'tvOS:simulator', 'visionOS:simulator', 'macOS:arm64', 'macOS:x86_64', 'macCatalys...
github
HubspotCommunity/hubspot-ruby
https://github.com/HubspotCommunity/hubspot-ruby
Guardfile
Ruby
mit
194
master
264
# A sample Guardfile # More info at https://github.com/guard/guard#readme guard :rspec, cmd: 'bundle exec rspec' do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" } end
github
HubspotCommunity/hubspot-ruby
https://github.com/HubspotCommunity/hubspot-ruby
Appraisals
Ruby
mit
194
master
283
appraise "activesupport_4.2" do gem "activesupport", "~> 4.2.2" end appraise "activesupport_5.0" do gem "activesupport", "~> 5.0.0" end appraise "activesupport_5.1" do gem "activesupport", "~> 5.1.0" end appraise "activesupport_5.2" do gem "activesupport", "~> 5.2.2" end
github
HubspotCommunity/hubspot-ruby
https://github.com/HubspotCommunity/hubspot-ruby
hubspot-ruby.gemspec
Ruby
mit
194
master
1,659
Gem::Specification.new do |s| s.name = "hubspot-ruby" s.version = "0.7.0" s.require_paths = ["lib"] s.authors = ["Andrew DiMichele", "Chris Bisnett"] s.description = "hubspot-ruby is a wrapper for the HubSpot REST API" s.licenses = ["MIT"] s.files = [".rspec", "Gemfile", "Guardfile", "LICENSE.txt", "READM...
github
HubspotCommunity/hubspot-ruby
https://github.com/HubspotCommunity/hubspot-ruby
Rakefile
Ruby
mit
194
master
725
# encoding: utf-8 require 'rubygems' require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'rake' require 'rspec/core' require 'rspec/core/rake_task' RSp...
github
HubspotCommunity/hubspot-ruby
https://github.com/HubspotCommunity/hubspot-ruby
spec/spec_helper.rb
Ruby
mit
194
master
1,051
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) RSPEC_ROOT = File.dirname(__FILE__) GEM_ROOT = File.expand_path("..", RSPEC_ROOT) require 'simplecov' SimpleCov.root GEM_ROOT SimpleCov.start do add_filter "/spec/" add_filter "/.bundle/" end require 'dot...