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 |
|---|---|---|---|---|---|---|---|---|
mamuso/acts_as_unvlogable | https://github.com/mamuso/acts_as_unvlogable/blob/a31180dd5a242790730432b2f81fb7d70306b60f/lib/acts_as_unvlogable/vg_wistia.rb | lib/acts_as_unvlogable/vg_wistia.rb | # ----------------------------------------------
# Class for Wistia (wistia.com)
# https://home.wistia.com/medias/e4a27b971d
# ----------------------------------------------
class VgWistia
attr_reader :title, :thumbnail, :duration, :service
def initialize(url=nil, options={})
@url = url
fetch_video_deta... | ruby | MIT | a31180dd5a242790730432b2f81fb7d70306b60f | 2026-01-04T17:40:12.920328Z | false |
mamuso/acts_as_unvlogable | https://github.com/mamuso/acts_as_unvlogable/blob/a31180dd5a242790730432b2f81fb7d70306b60f/lib/acts_as_unvlogable/object_base.rb | lib/acts_as_unvlogable/object_base.rb | # This removes the activesupport dependency
class Object
def blank?
respond_to?(:empty?) ? empty? : !self
end
def instance_values #:nodoc:
instance_variables.inject({}) do |values, name|
values[name.to_s[1..-1]] = instance_variable_get(name)
values
end
end
end | ruby | MIT | a31180dd5a242790730432b2f81fb7d70306b60f | 2026-01-04T17:40:12.920328Z | false |
mamuso/acts_as_unvlogable | https://github.com/mamuso/acts_as_unvlogable/blob/a31180dd5a242790730432b2f81fb7d70306b60f/lib/acts_as_unvlogable/vg_vimeo.rb | lib/acts_as_unvlogable/vg_vimeo.rb | # ----------------------------------------------
# Class for Vimeo (vimeo.com)
# http://vimeo.com/5362441
# ----------------------------------------------
class VgVimeo
def initialize(url=nil, options={})
# general settings
@url = url
@video_id = parse_url(url)
res = Net::HTTP.get(URI.parse("http... | ruby | MIT | a31180dd5a242790730432b2f81fb7d70306b60f | 2026-01-04T17:40:12.920328Z | false |
mamuso/acts_as_unvlogable | https://github.com/mamuso/acts_as_unvlogable/blob/a31180dd5a242790730432b2f81fb7d70306b60f/lib/acts_as_unvlogable/vg_youtu.rb | lib/acts_as_unvlogable/vg_youtu.rb | require "acts_as_unvlogable/vg_youtube"
class VgYoutu < VgYoutube
def initialize(url=nil, options={})
url = URI(url)
url.host = 'www.youtube.com'
url.query = "#{url.query}&v=#{url.path[1..-1]}"
url.path = '/watch'
super(url.to_s, options)
end
end
| ruby | MIT | a31180dd5a242790730432b2f81fb7d70306b60f | 2026-01-04T17:40:12.920328Z | false |
mamuso/acts_as_unvlogable | https://github.com/mamuso/acts_as_unvlogable/blob/a31180dd5a242790730432b2f81fb7d70306b60f/lib/acts_as_unvlogable/string_extend.rb | lib/acts_as_unvlogable/string_extend.rb | class String
def query_param(param_name)
raise ArgumentError.new("param name can't be nil") if param_name.blank?
uri = URI.parse(self)
(CGI::parse(uri.query)[param_name].first.to_s if uri.query) || nil
end
end | ruby | MIT | a31180dd5a242790730432b2f81fb7d70306b60f | 2026-01-04T17:40:12.920328Z | false |
mamuso/acts_as_unvlogable | https://github.com/mamuso/acts_as_unvlogable/blob/a31180dd5a242790730432b2f81fb7d70306b60f/lib/acts_as_unvlogable/vg_flickr.rb | lib/acts_as_unvlogable/vg_flickr.rb | # ----------------------------------------------
# Class for Flickr (flickr.com)
# http://www.flickr.com/photos/andina/3158762127/in/photostream/
# ----------------------------------------------
class VgFlickr
def initialize(url=nil, options={})
# general settings
@url = url
@video_id = parse_url(u... | ruby | MIT | a31180dd5a242790730432b2f81fb7d70306b60f | 2026-01-04T17:40:12.920328Z | false |
mamuso/acts_as_unvlogable | https://github.com/mamuso/acts_as_unvlogable/blob/a31180dd5a242790730432b2f81fb7d70306b60f/lib/acts_as_unvlogable/flickr.rb | lib/acts_as_unvlogable/flickr.rb | # included here to skip the gem dependency and modified to manage video capabilities.
# this is the updated version from http://github.com/ctagg/flickr/tree/master/lib/flickr.rb
# Modified and simplified to keep only the used methods
require 'cgi'
require 'net/http'
require 'xmlsimple'
require 'digest/md5'
# Flickr c... | ruby | MIT | a31180dd5a242790730432b2f81fb7d70306b60f | 2026-01-04T17:40:12.920328Z | false |
mamuso/acts_as_unvlogable | https://github.com/mamuso/acts_as_unvlogable/blob/a31180dd5a242790730432b2f81fb7d70306b60f/lib/acts_as_unvlogable/vg_giphy.rb | lib/acts_as_unvlogable/vg_giphy.rb | class VgGiphy
attr_accessor :video_id
def initialize(url, options={})
@url = url
@uri = URI.parse(url)
@video_id = @uri.path.match(/gifs\/([\w\-\d]+)/)[1].split("-")[-1]
json_endpoint = "http://api.giphy.com/v1/gifs?api_key=dc6zaTOxFJmzC&ids=#{@video_id}"
@json = JSON.parse(Net::HTTP.get(URI.... | ruby | MIT | a31180dd5a242790730432b2f81fb7d70306b60f | 2026-01-04T17:40:12.920328Z | false |
mamuso/acts_as_unvlogable | https://github.com/mamuso/acts_as_unvlogable/blob/a31180dd5a242790730432b2f81fb7d70306b60f/lib/acts_as_unvlogable/vg_vine.rb | lib/acts_as_unvlogable/vg_vine.rb | class VgVine
attr_accessor :video_id
def initialize(url, options={})
@url = url
@uri = URI.parse(url)
@video_id = @uri.path.match(/v\/([\w\d]+)/)[1]
json_endpoint = "https://vine.co/oembed/#{@video_id}.json"
@json = JSON.parse(Net::HTTP.get(URI.parse(json_endpoint)))
raise ArgumentError u... | ruby | MIT | a31180dd5a242790730432b2f81fb7d70306b60f | 2026-01-04T17:40:12.920328Z | false |
mamuso/acts_as_unvlogable | https://github.com/mamuso/acts_as_unvlogable/blob/a31180dd5a242790730432b2f81fb7d70306b60f/lib/acts_as_unvlogable/vg_metacafe.rb | lib/acts_as_unvlogable/vg_metacafe.rb | # ----------------------------------------------
# Class for Metacafe (www.metacafe.com)
# http://www.metacafe.com/watch/476621/experiments_with_the_myth_busters_with_diet_coke_and_mentos_dry/
# ----------------------------------------------
class VgMetacafe
def initialize(url=nil, options={})
@url = url
... | ruby | MIT | a31180dd5a242790730432b2f81fb7d70306b60f | 2026-01-04T17:40:12.920328Z | false |
mamuso/acts_as_unvlogable | https://github.com/mamuso/acts_as_unvlogable/blob/a31180dd5a242790730432b2f81fb7d70306b60f/lib/acts_as_unvlogable/string_base.rb | lib/acts_as_unvlogable/string_base.rb | # This removes the activesupport dependency
class String
def camelize(first_letter_in_uppercase = true)
if first_letter_in_uppercase
self.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
else
self.first + camelize(self)[1..-1]
end
end
def constantize
... | ruby | MIT | a31180dd5a242790730432b2f81fb7d70306b60f | 2026-01-04T17:40:12.920328Z | false |
mamuso/acts_as_unvlogable | https://github.com/mamuso/acts_as_unvlogable/blob/a31180dd5a242790730432b2f81fb7d70306b60f/lib/acts_as_unvlogable/vg_11870.rb | lib/acts_as_unvlogable/vg_11870.rb | # ----------------------------------------------
# Class for 11870 (11870.com)
# http://11870.com/pro/chic-basic-born/media/b606abfe
# ----------------------------------------------
class Vg11870
def initialize(url=nil, options={})
@url = url.sub "http:", "https:"
@page = Nokogiri::HTML(open(@url))
e... | ruby | MIT | a31180dd5a242790730432b2f81fb7d70306b60f | 2026-01-04T17:40:12.920328Z | false |
mamuso/acts_as_unvlogable | https://github.com/mamuso/acts_as_unvlogable/blob/a31180dd5a242790730432b2f81fb7d70306b60f/lib/acts_as_unvlogable/vg_gfycat.rb | lib/acts_as_unvlogable/vg_gfycat.rb | class VgGfycat
attr_accessor :video_id
def initialize(url, options={})
@url = url
@uri = URI.parse(url)
@video_id = @uri.path.split("/")[-1]
json_endpoint = "https://gfycat.com/cajax/get/#{@video_id}"
@json = JSON.parse(Net::HTTP.get(URI.parse(json_endpoint)))
raise ArgumentError unless @... | ruby | MIT | a31180dd5a242790730432b2f81fb7d70306b60f | 2026-01-04T17:40:12.920328Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/value_parser_test.rb | test/value_parser_test.rb | require "test_helper"
class FilterTest < ActiveSupport::TestCase
test "returns the original value without options" do
parser = Sift::ValueParser.new(value: "hi")
assert_equal "hi", parser.parse
end
test "With options an array of integers results in an array of integers" do
parser = Sift::ValueParse... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/controller_inheritance_test.rb | test/controller_inheritance_test.rb | require "test_helper"
class PostsInheritanceTest < ActionDispatch::IntegrationTest
test "it works" do
post = Post.create!
get("/posts_alt")
json = JSON.parse(@response.body)
assert_equal 1, json.size
assert_equal(post.id, json.first["id"])
end
test "it inherits filter from parent controlle... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/sort_test.rb | test/sort_test.rb | require "test_helper"
class SortTest < ActiveSupport::TestCase
test "it is initialized with the a param and a type" do
sort = Sift::Sort.new("hi", :int, "hi")
assert_equal "hi", sort.param
assert_equal :int, sort.type
assert_equal "hi", sort.parameter.internal_name
end
test "it raises if the ty... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/type_validator_test.rb | test/type_validator_test.rb | require "test_helper"
class TypeValidatorTest < ActiveSupport::TestCase
test "it does not accept a type that is not whitelisted" do
validator = Sift::TypeValidator.new("test", :foo_bar)
assert_equal false, validator.valid_type?
end
test "it accepts types that are whitelisted" do
validator = Sift::T... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/sift_test.rb | test/sift_test.rb | require "test_helper"
class SiftTest < ActiveSupport::TestCase
class MyClass
attr_writer :params
include Sift
def params
@params ||= ActionController::Parameters.new({})
end
end
test "does nothing if no filters are registered" do
MyClass.reset_filters
assert_equal [], MyClass.new.... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/controller_test.rb | test/controller_test.rb | require "test_helper"
class PostsControllerTest < ActionDispatch::IntegrationTest
test "it works" do
post = Post.create!
get("/posts")
json = JSON.parse(@response.body)
assert_equal 1, json.size
assert_equal(post.id, json.first["id"])
end
test "it filters on id by value" do
post = Post... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/filter_test.rb | test/filter_test.rb | require "test_helper"
class FilterTest < ActiveSupport::TestCase
test "it is initialized with the a param and a type" do
filter = Sift::Filter.new("hi", :int, "hi", nil)
assert_equal "hi", filter.param
assert_equal :int, filter.type
assert_equal "hi", filter.parameter.internal_name
end
test "it... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/filter_validator_test.rb | test/filter_validator_test.rb | require "test_helper"
class FilterValidatorTest < ActiveSupport::TestCase
test "it validates that integers are string integers" do
filter = Sift::Filter.new(:hi, :int, :hi, nil)
validator = Sift::FilterValidator.build(
filters: [filter],
sort_fields: [],
filter_params: { hi: "1" },
so... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/test_helper.rb | test/test_helper.rb | # Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../test/dummy/config/environment.rb", __dir__)
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../test/dummy/db/migrate", __dir__)]
require "rails/test_help"
require 'minitest/autorun'
# Filter out Minitest backtrace while ... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/filtrator_test.rb | test/filtrator_test.rb | require "test_helper"
class FiltratorTest < ActiveSupport::TestCase
test "it takes a collection, params and (optional) filters" do
Sift::Filtrator.new(Post.all, { id: 1 }, [])
end
test "it filters by all the filters you pass it" do
post = Post.create!
filter = Sift::Filter.new(:id, :int, :id, nil)
... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/app/jobs/application_job.rb | test/dummy/app/jobs/application_job.rb | class ApplicationJob < ActiveJob::Base
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/app/helpers/posts_helper.rb | test/dummy/app/helpers/posts_helper.rb | module PostsHelper
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/app/helpers/application_helper.rb | test/dummy/app/helpers/application_helper.rb | module ApplicationHelper
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/app/controllers/posts_controller.rb | test/dummy/app/controllers/posts_controller.rb | class PostsController < ApplicationController
include Sift
LOCAL_TIME_ZONE = "America/New_York"
filter_on :id, type: :int
filter_on :priority, type: :int
filter_on :rating, type: :decimal
filter_on :visible, type: :boolean
filter_on :title, type: :string
filter_on :body, type: :text
filter_on :expir... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/app/controllers/posts_alt_controller.rb | test/dummy/app/controllers/posts_alt_controller.rb | class PostsAltController < PostsController
filter_on :body, type: :int, internal_name: :priority
sort_on :body, type: :int, internal_name: :priority
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/app/controllers/application_controller.rb | test/dummy/app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/app/models/post.rb | test/dummy/app/models/post.rb | class Post < ApplicationRecord
scope :expired_before, ->(date) {
where("expiration < ?", date)
}
scope :body2, ->(text) {
where(body: text)
}
scope :body_and_priority, ->(text, priority) {
where(body: text, priority: priority)
}
scope :order_on_body_no_params, -> {
order(body: :desc)
... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/app/models/application_record.rb | test/dummy/app/models/application_record.rb | class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/app/mailers/application_mailer.rb | test/dummy/app/mailers/application_mailer.rb | class ApplicationMailer < ActionMailer::Base
default from: "from@example.com"
layout "mailer"
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/app/channels/application_cable/channel.rb | test/dummy/app/channels/application_cable/channel.rb | module ApplicationCable
class Channel < ActionCable::Channel::Base
end
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/app/channels/application_cable/connection.rb | test/dummy/app/channels/application_cable/connection.rb | module ApplicationCable
class Connection < ActionCable::Connection::Base
end
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/db/schema.rb | test/dummy/db/schema.rb | # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# dat... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/db/migrate/20160909014304_create_posts.rb | test/dummy/db/migrate/20160909014304_create_posts.rb | class CreatePosts < ActiveRecord::Migration[5.0]
def change
create_table :posts do |t|
t.integer :priority
t.decimal :rating
t.boolean :visible
t.string :title
t.text :body
t.date :expiration
t.time :hidden_after
t.datetime :published_at
t.timestamps
end
... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/db/migrate/20200512151604_add_metadata_to_posts.rb | test/dummy/db/migrate/20200512151604_add_metadata_to_posts.rb | class AddMetadataToPosts < ActiveRecord::Migration[5.0]
def change
add_column :posts, :metadata, :json
end
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/test/controllers/posts_controller_test.rb | test/dummy/test/controllers/posts_controller_test.rb | require "test_helper"
class PostsControllerTest < ActionDispatch::IntegrationTest
# test "the truth" do
# assert true
# end
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/test/models/post_test.rb | test/dummy/test/models/post_test.rb | require "test_helper"
class PostTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/application.rb | test/dummy/config/application.rb | require_relative "boot"
require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails ver... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/environment.rb | test/dummy/config/environment.rb | # Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/puma.rb | test/dummy/config/puma.rb | # Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/routes.rb | test/dummy/config/routes.rb | Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
resources :posts
resources :posts_alt
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/spring.rb | test/dummy/config/spring.rb | [".ruby-version", ".rbenv-vars", "tmp/restart.txt", "tmp/caching-dev.txt"].each { |path| Spring.watch(path) }
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/boot.rb | test/dummy/config/boot.rb | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/initializers/filter_parameter_logging.rb | test/dummy/config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/initializers/application_controller_renderer.rb | test/dummy/config/initializers/application_controller_renderer.rb | # Be sure to restart your server when you modify this file.
# ActiveSupport::Reloader.to_prepare do
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )
# end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/initializers/session_store.rb | test/dummy/config/initializers/session_store.rb | # Be sure to restart your server when you modify this file.
Rails.application.config.session_store :cookie_store, key: "_dummy_session"
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/initializers/wrap_parameters.rb | test/dummy/config/initializers/wrap_parameters.rb | # Be sure to restart your server when you modify this file.
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do
wrap_parameters f... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/initializers/inflections.rb | test/dummy/config/initializers/inflections.rb | # Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflec... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/initializers/cookies_serializer.rb | test/dummy/config/initializers/cookies_serializer.rb | # Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/initializers/backtrace_silencers.rb | test/dummy/config/initializers/backtrace_silencers.rb | # Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a probl... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/initializers/mime_types.rb | test/dummy/config/initializers/mime_types.rb | # Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/environments/test.rb | test/dummy/config/environments/test.rb | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suit... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/environments/development.rb | test/dummy/config/environments/development.rb | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web serv... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/test/dummy/config/environments/production.rb | test/dummy/config/environments/production.rb | Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, allowing both threaded web serve... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/procore-sift.rb | lib/procore-sift.rb | require "sift/filter"
require "sift/filter_validator"
require "sift/filtrator"
require "sift/sort"
require "sift/subset_comparator"
require "sift/type_validator"
require "sift/parameter"
require "sift/value_parser"
require "sift/scope_handler"
require "sift/where_handler"
require "sift/validators/valid_int_validator"
r... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/where_handler.rb | lib/sift/where_handler.rb | module Sift
class WhereHandler
def initialize(param)
@param = param
end
def call(collection, value, _params, _scope_params)
if @param.type == :jsonb
apply_jsonb_conditions(collection, value)
else
collection.where(@param.internal_name => value)
end
end
priv... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/type_validator.rb | lib/sift/type_validator.rb | module Sift
# TypeValidator validates that the incoming param is of the specified type
class TypeValidator
DATETIME_RANGE_PATTERN = { format: { with: /\A.+(?:[^.]\.\.\.[^.]).+\z/, message: "must be a range" }, valid_date_range: true }.freeze
DECIMAL_PATTERN = { numericality: true, allow_nil: true }.freeze
... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/version.rb | lib/sift/version.rb | module Sift
VERSION = "1.0.0".freeze
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/filter_validator.rb | lib/sift/filter_validator.rb | # Here be dragons:
# there are two forms of metaprogramming in this file
# instance variables are being dynamically set based on the param name
# and we are class evaling `validates` to create dynamic validations
# based on the filters being validated.
module Sift
class FilterValidator
include ActiveModel::Valida... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/scope_handler.rb | lib/sift/scope_handler.rb | module Sift
class ScopeHandler
def initialize(param)
@param = param
end
def call(collection, value, params, scope_params)
collection.public_send(@param.internal_name, *scope_parameters(value, params, scope_params))
end
def scope_parameters(value, params, scope_params)
if scope_... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/parameter.rb | lib/sift/parameter.rb | module Sift
# Value Object that wraps some handling of filter params
class Parameter
attr_reader :param, :type, :internal_name
def initialize(param, type, internal_name = param)
@param = param
@type = type
@internal_name = internal_name
end
def parse_options
{
suppo... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/filter.rb | lib/sift/filter.rb | module Sift
# Filter describes the way a parameter maps to a database column
# and the type information helpful for validating input.
class Filter
attr_reader :parameter, :default, :custom_validate, :scope_params
def initialize(param, type, internal_name, default, custom_validate = nil, scope_params = []... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/sort.rb | lib/sift/sort.rb | module Sift
# Sort provides the same interface as a filter,
# but instead of applying a `where` to the collection
# it applies an `order`.
class Sort
attr_reader :parameter, :scope_params
WHITELIST_TYPES = [:int,
:decimal,
:string,
:t... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/subset_comparator.rb | lib/sift/subset_comparator.rb | module Sift
class SubsetComparator
def initialize(array)
@array = array
end
def include?(other)
other = [other] unless other.is_a?(Array)
@array.to_set >= other.to_set
end
end
end
| ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/filtrator.rb | lib/sift/filtrator.rb | module Sift
# Filtrator takes a collection, params and a set of filters
# and applies them to create a new active record collection
# with those filters applied.
class Filtrator
attr_reader :collection, :params, :filters, :sort
def self.filter(collection, params, filters, sort = [])
new(collectio... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/value_parser.rb | lib/sift/value_parser.rb | module Sift
class ValueParser
def initialize(value:, type: nil, options: {})
@value = value
@supports_boolean = options.fetch(:supports_boolean, false)
@supports_ranges = options.fetch(:supports_ranges, false)
@supports_json = options.fetch(:supports_json, false)
@supports_json_objec... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/validators/valid_json_validator.rb | lib/sift/validators/valid_json_validator.rb | class ValidJsonValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
record.errors.add attribute, "must be a valid JSON" unless valid_json?(value)
end
private
def valid_json?(value)
value = value.strip if value.is_a?(String)
JSON.parse(value)
rescue JSON::ParserError... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/validators/valid_int_validator.rb | lib/sift/validators/valid_int_validator.rb | class ValidIntValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
record.errors.add attribute, (options[:message] || "must be integer, array of integers, or range") unless
valid_int?(value)
end
private
def valid_int?(value)
integer_array?(value) || integer_or_range... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
procore/sift | https://github.com/procore/sift/blob/8962e91f58b2ee4e602c42a87832e4fc3a8b0608/lib/sift/validators/valid_date_range_validator.rb | lib/sift/validators/valid_date_range_validator.rb | class ValidDateRangeValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
record.errors.add attribute, "is invalid" unless valid_date_range?(value)
end
private
def valid_date_range?(date_range)
from_date_string, end_date_string = date_range.to_s.split("...")
return tru... | ruby | MIT | 8962e91f58b2ee4e602c42a87832e4fc3a8b0608 | 2026-01-04T17:40:14.523181Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/test/test_helper.rb | test/test_helper.rb | require 'rubygems'
require 'bundler'
Bundler.require :test
require 'coveralls'
Coveralls.wear!
require 'simplecov'
SimpleCov.start
require 'minitest/autorun'
require 'quesadilla'
# Support files
Dir["#{File.expand_path(File.dirname(__FILE__))}/support/*.rb"].each do |file|
require file
end
class Quesadilla::Test... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/test/quesadilla_test.rb | test/quesadilla_test.rb | require 'test_helper'
module Quesadilla
class QuesadillaTest < TestCase
def test_that_it_has_a_version_number
refute_nil VERSION
end
def test_module_method
assert_equal 'Hi', Quesadilla.extract('Hi')[:display_text]
end
end
end
| ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/test/quesadilla/multi_test.rb | test/quesadilla/multi_test.rb | # encoding: UTF-8
require 'test_helper'
module Quesadilla
class MultiTest < TestCase
def test_that_it_extracts_links_and_tags
extraction = extract('Something #tagged with a link http://samsoff.es/posts/hire-sam')
expected = {
display_text: 'Something #tagged with a link samsoff.es/posts/hire-... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/test/quesadilla/emoji_test.rb | test/quesadilla/emoji_test.rb | # encoding: UTF-8
require 'test_helper'
module Quesadilla
class EmojiTest < TestCase
def test_that_it_supports_emoji
extraction = extract('Something with 👨 beardface')
expected = {
display_text: 'Something with 👨 beardface',
display_html: 'Something with 👨 beardface',
entit... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/test/quesadilla/html_test.rb | test/quesadilla/html_test.rb | # encoding: UTF-8
require 'test_helper'
module Quesadilla
class CustomRenderer < HTMLRenderer
def hashtag(display_text, hashtag)
%Q{<a href="#tag-#{hashtag}" class="tag">#{display_text}</a>}
end
end
class HTMLTest < TestCase
def test_hashtag_url_format
extraction = extract('Something #t... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/test/quesadilla/markdown_test.rb | test/quesadilla/markdown_test.rb | # encoding: UTF-8
require 'test_helper'
module Quesadilla
class MarkdownTest < TestCase
def test_that_it_extracts_links
extraction = extract('Read [my resume](http://samsoff.es/resume) if you want')
expected = {
display_text: 'Read my resume if you want',
display_html: 'Read <a href="... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/test/quesadilla/autolink_test.rb | test/quesadilla/autolink_test.rb | # encoding: UTF-8
require 'test_helper'
module Quesadilla
class AutolinkTest < TestCase
def test_that_it_extracts_plain_links
extraction = extract('Something with a link: http://samsoff.es/posts/hire-sam')
assert_equal extraction, {
display_text: 'Something with a link: samsoff.es/posts/hire-... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/test/quesadilla/users_test.rb | test/quesadilla/users_test.rb | # encoding: UTF-8
require 'test_helper'
module Quesadilla
class AutolinkTest < TestCase
def test_extracting_users
extraction = extract('You should follow @soffes on Twitter', users: true)
expected = {
display_text: 'You should follow @soffes on Twitter',
display_html: 'You should foll... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/test/quesadilla/hashtags_test.rb | test/quesadilla/hashtags_test.rb | # encoding: UTF-8
require 'test_helper'
module Quesadilla
class HashtagsTest < TestCase
def test_that_it_extracts_tags
extraction = extract('Something #tagged')
expected = {
display_text: 'Something #tagged',
display_html: 'Something <a href="#hashtag-tagged" class="hashtag">#tagged</... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/lib/quesadilla.rb | lib/quesadilla.rb | require 'quesadilla/version'
require 'quesadilla/html_renderer'
require 'quesadilla/extractor'
# Ruby library for entity-style text parsing. Quesadilla was extracted from [Cheddar](https://cheddarapp.com).
module Quesadilla
# Emphasis (italic) entity type
ENTITY_TYPE_EMPHASIS = 'emphasis'.freeze
# Double emphas... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/lib/quesadilla/version.rb | lib/quesadilla/version.rb | module Quesadilla
# Version of the Quesadilla gem
VERSION = '0.1.3'
end
| ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/lib/quesadilla/html_renderer.rb | lib/quesadilla/html_renderer.rb | module Quesadilla
# Default HTML renderer for generating HTML
class HTMLRenderer
# HTML representation of italic text
# @param display_text [String] the italic text
# @return [String] HTML representation of the italic text
def emphasis(display_text)
%Q{<em>#{display_text}</em>}
end
# ... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/lib/quesadilla/extractor.rb | lib/quesadilla/extractor.rb | # encoding: UTF-8
module Quesadilla
# Extract entities from text
class Extractor
require 'quesadilla/core_ext/string'
Dir[File.expand_path('../extractor/*.rb', __FILE__)].each { |f| require f }
include Autolinks
include Emoji
include Hashtags
include HTML
include Markdown
include U... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/lib/quesadilla/extractor/users.rb | lib/quesadilla/extractor/users.rb | module Quesadilla
class Extractor
# Extract user mentions.
#
# This module has no public methods.
module Users
private
require 'twitter-text'
def extract_users
Twitter::Extractor::extract_mentioned_screen_names_with_indices(@working_text).each do |entity|
display_te... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/lib/quesadilla/extractor/autolinks.rb | lib/quesadilla/extractor/autolinks.rb | # encoding: UTF-8
module Quesadilla
class Extractor
# Extract plain links.
#
# This module has no public methods.
module Autolinks
private
require 'twitter-text'
def extract_autolinks
Twitter::Extractor::extract_urls_with_indices(@working_text).each do |entity|
ent... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/lib/quesadilla/extractor/emoji.rb | lib/quesadilla/extractor/emoji.rb | # encoding: UTF-8
module Quesadilla
class Extractor
# Extract named emoji.
#
# This module has no public methods.
module Emoji
private
require 'named_emoji'
# Emoji colon-syntax regex
EMOJI_COLON_REGEX = %r{:([a-zA-Z0-9_\-\+]+):}.freeze
def replace_emoji
codes =... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/lib/quesadilla/extractor/markdown.rb | lib/quesadilla/extractor/markdown.rb | # encoding: UTF-8
module Quesadilla
class Extractor
# Extract Markdown.
#
# This module has no public methods.
module Markdown
private
# Gruber's regex is recursive, but I can't figure out how to do it in Ruby without the `g` option.
# Maybe I should use StringScanner instead. For no... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/lib/quesadilla/extractor/hashtags.rb | lib/quesadilla/extractor/hashtags.rb | # encoding: UTF-8
module Quesadilla
class Extractor
# Extract hashtags.
#
# This module has no public methods.
module Hashtags
private
require 'twitter-text'
def extract_hashtags
Twitter::Extractor::extract_hashtags_with_indices(@working_text).each do |entity|
hash... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/lib/quesadilla/extractor/html.rb | lib/quesadilla/extractor/html.rb | # encoding: UTF-8
module Quesadilla
class Extractor
# Convert entites and entire string to HTML.
#
# This module has no public methods.
module HTML
private
HTML_ESCAPE_MAP = [
{
pattern: '&',
text: '&',
placeholder: "\uf050",
},
... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
soffes/quesadilla | https://github.com/soffes/quesadilla/blob/5973ed799beed342f05857ca9f49f63d155f4186/lib/quesadilla/core_ext/string.rb | lib/quesadilla/core_ext/string.rb | # String additions
class String
# Truncate method from ActiveSupport.
# @param truncate_at [Fixnum] number of characters to truncate after
# @param options [Hash] optional options hash
# @option options separator [String] truncate text only at a certain separator strings
# @option options omission [String] st... | ruby | MIT | 5973ed799beed342f05857ca9f49f63d155f4186 | 2026-01-04T17:40:19.429994Z | false |
dgilperez/validates_zipcode | https://github.com/dgilperez/validates_zipcode/blob/8cfa7118792a138b2939e62d81345a2b2bf3e805/spec/validates_zipcode_spec.rb | spec/validates_zipcode_spec.rb | # frozen_string_literal: true
require 'spec_helper'
# NOTE: Spain has the full case specs.
# Do not apply all checks to all countries for suite speed.
describe ValidatesZipcode, '#validate_each' do
TEST_DATA.each do |country_code, values|
context country_code do
context 'validates with valid zipcodes... | ruby | MIT | 8cfa7118792a138b2939e62d81345a2b2bf3e805 | 2026-01-04T17:40:25.055925Z | false |
dgilperez/validates_zipcode | https://github.com/dgilperez/validates_zipcode/blob/8cfa7118792a138b2939e62d81345a2b2bf3e805/spec/format_zipcode_spec.rb | spec/format_zipcode_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe ValidatesZipcode::Formatter, '#format' do
context 'Canada' do
it { check_format('CA', 'l3b3z6' => 'L3B 3Z6') }
it { check_format('ca', 'V2r-1c8' => 'V2R 1C8') }
it { check_format(:ca, 'g9a 5w1' => 'G9A 5W1') }
end
context 'Czech' do
it... | ruby | MIT | 8cfa7118792a138b2939e62d81345a2b2bf3e805 | 2026-01-04T17:40:25.055925Z | false |
dgilperez/validates_zipcode | https://github.com/dgilperez/validates_zipcode/blob/8cfa7118792a138b2939e62d81345a2b2bf3e805/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'validates_zipcode'
TEST_DATA = {
GB: {
valid: [
'ID1 1QD',
'M32 0JG',
'NE30 1DP',
'OX49 5NU',
'SW1A 2AA',
'W1K 7DA',
'id1 1qd',
'Sw1A 2aA',
'id11qd',
'SW1A2AA'
],
invalid: [
nil,
'',
'inva... | ruby | MIT | 8cfa7118792a138b2939e62d81345a2b2bf3e805 | 2026-01-04T17:40:25.055925Z | true |
dgilperez/validates_zipcode | https://github.com/dgilperez/validates_zipcode/blob/8cfa7118792a138b2939e62d81345a2b2bf3e805/lib/validates_zipcode.rb | lib/validates_zipcode.rb | # frozen_string_literal: true
require 'validates_zipcode/railtie' if defined?(Rails)
require 'validates_zipcode/cldr_regex_collection'
require 'validates_zipcode/invalid_zipcode_error'
require 'validates_zipcode/validator'
require 'validates_zipcode/helper_methods'
require 'validates_zipcode/version'
require 'validates... | ruby | MIT | 8cfa7118792a138b2939e62d81345a2b2bf3e805 | 2026-01-04T17:40:25.055925Z | false |
dgilperez/validates_zipcode | https://github.com/dgilperez/validates_zipcode/blob/8cfa7118792a138b2939e62d81345a2b2bf3e805/lib/validates_zipcode/helper_methods.rb | lib/validates_zipcode/helper_methods.rb | # frozen_string_literal: true
module ActiveModel
module Validations
module HelperMethods
def validates_zipcode(*attr_names)
validates_with ZipcodeValidator, _merge_attributes(attr_names)
end
end
end
end
| ruby | MIT | 8cfa7118792a138b2939e62d81345a2b2bf3e805 | 2026-01-04T17:40:25.055925Z | false |
dgilperez/validates_zipcode | https://github.com/dgilperez/validates_zipcode/blob/8cfa7118792a138b2939e62d81345a2b2bf3e805/lib/validates_zipcode/version.rb | lib/validates_zipcode/version.rb | # frozen_string_literal: true
module ValidatesZipcode
VERSION = '0.5.4'
end
| ruby | MIT | 8cfa7118792a138b2939e62d81345a2b2bf3e805 | 2026-01-04T17:40:25.055925Z | false |
dgilperez/validates_zipcode | https://github.com/dgilperez/validates_zipcode/blob/8cfa7118792a138b2939e62d81345a2b2bf3e805/lib/validates_zipcode/zipcode.rb | lib/validates_zipcode/zipcode.rb | # frozen_string_literal: true
module ValidatesZipcode
class Zipcode
include CldrRegexpCollection
def initialize(args = {})
@zipcode = args.fetch(:zipcode)
@country_alpha2 = args.fetch(:country_alpha2)
@excluded_country_codes = args.fetch(:excluded_country_codes, [])
... | ruby | MIT | 8cfa7118792a138b2939e62d81345a2b2bf3e805 | 2026-01-04T17:40:25.055925Z | false |
dgilperez/validates_zipcode | https://github.com/dgilperez/validates_zipcode/blob/8cfa7118792a138b2939e62d81345a2b2bf3e805/lib/validates_zipcode/railtie.rb | lib/validates_zipcode/railtie.rb | # frozen_string_literal: true
module ValidatesZipcode
class Railtie < Rails::Railtie
end
end
| ruby | MIT | 8cfa7118792a138b2939e62d81345a2b2bf3e805 | 2026-01-04T17:40:25.055925Z | false |
dgilperez/validates_zipcode | https://github.com/dgilperez/validates_zipcode/blob/8cfa7118792a138b2939e62d81345a2b2bf3e805/lib/validates_zipcode/validator.rb | lib/validates_zipcode/validator.rb | # frozen_string_literal: true
# Usage:
#
# class User < ActiveModel
# validates :postalcode, zipcode: true
#
# # Default country_alpha2 attribute.
# # You can change it using :country_code_attribute option
# def country_alpha2
# country.alpha2
# end
# end
#
require 'active_model'
require 'active_model/va... | ruby | MIT | 8cfa7118792a138b2939e62d81345a2b2bf3e805 | 2026-01-04T17:40:25.055925Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.