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 |
|---|---|---|---|---|---|---|---|---|
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/components/avo/fields/gravatar_field/show_component.rb | app/components/avo/fields/gravatar_field/show_component.rb | # frozen_string_literal: true
class Avo::Fields::GravatarField::ShowComponent < Avo::Fields::ShowComponent
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/components/avo/fields/json_viewer_field/edit_component.rb | app/components/avo/fields/json_viewer_field/edit_component.rb | # frozen_string_literal: true
class Avo::Fields::JsonViewerField::EditComponent < Avo::Fields::CodeField::EditComponent
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/components/avo/fields/json_viewer_field/show_component.rb | app/components/avo/fields/json_viewer_field/show_component.rb | # frozen_string_literal: true
class Avo::Fields::JsonViewerField::ShowComponent < Avo::Fields::CodeField::ShowComponent
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/components/avo/fields/json_viewer_field/index_component.rb | app/components/avo/fields/json_viewer_field/index_component.rb | # frozen_string_literal: true
class Avo::Fields::JsonViewerField::IndexComponent < Avo::Fields::IndexComponent
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/components/avo/fields/audited_changes_field/show_component.rb | app/components/avo/fields/audited_changes_field/show_component.rb | # frozen_string_literal: true
class Avo::Fields::AuditedChangesField::ShowComponent < Avo::Fields::ShowComponent
def records
field.value["records"]&.map do |gid, body|
changes, unchanged = body.values_at("changes", "unchanged")
[gid, changes, unchanged]
end
end
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/components/avo/fields/event_additional_field/index_component.rb | app/components/avo/fields/event_additional_field/index_component.rb | # frozen_string_literal: true
class Avo::Fields::EventAdditionalField::IndexComponent < Avo::Fields::IndexComponent
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/components/avo/fields/nested_field/edit_component.rb | app/components/avo/fields/nested_field/edit_component.rb | # frozen_string_literal: true
class Avo::Fields::NestedField::EditComponent < Avo::Fields::EditComponent
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/components/avo/fields/nested_field/show_component.rb | app/components/avo/fields/nested_field/show_component.rb | # frozen_string_literal: true
class Avo::Fields::NestedField::ShowComponent < Avo::Fields::ShowComponent
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/components/avo/fields/nested_field/index_component.rb | app/components/avo/fields/nested_field/index_component.rb | # frozen_string_literal: true
class Avo::Fields::NestedField::IndexComponent < Avo::Fields::IndexComponent
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/components/avo/fields/select_record_field/edit_component.rb | app/components/avo/fields/select_record_field/edit_component.rb | # frozen_string_literal: true
class Avo::Fields::SelectRecordField::EditComponent < Avo::Fields::BelongsToField::EditComponent
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/rubygem.rb | app/models/rubygem.rb | class Rubygem < ApplicationRecord
include Patterns
include RubygemSearchable
has_many :ownerships, -> { confirmed }, dependent: :destroy, inverse_of: :rubygem
has_many :ownerships_including_unconfirmed, dependent: :destroy, class_name: "Ownership"
has_many :owners, through: :ownerships, source: :user
has_m... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/events.rb | app/models/events.rb | module Events
def self.table_name_prefix
"events_"
end
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/subscription.rb | app/models/subscription.rb | class Subscription < ApplicationRecord
belongs_to :rubygem
belongs_to :user
validates :rubygem_id, uniqueness: { scope: :user_id }
validates :user, :rubygem, presence: true
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/current.rb | app/models/current.rb | class Current < ActiveSupport::CurrentAttributes
attribute :request
attribute :user
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/organization_invite.rb | app/models/organization_invite.rb | class OrganizationInvite < ApplicationRecord
belongs_to :invitable, polymorphic: true
belongs_to :user
validates :user_id, uniqueness: { scope: %i[invitable_type invitable_id] }
enum :role, { owner: "owner", admin: "admin", maintainer: "maintainer", outside_contributor: "outside_contributor" },
validate: ... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/rubygem_contents.rb | app/models/rubygem_contents.rb | # frozen_string_literal: true
class RubygemContents
CHECKSUMS_ROOT_FORMAT = "gems/%{gem}/checksums/"
CHECKSUMS_KEY_FORMAT = "gems/%{gem}/checksums/%{version}.%{format}"
CONTENT_ROOT_FORMAT = "gems/%{gem}/contents/"
CONTENT_KEY_FORMAT = "gems/%{gem}/contents/%{fingerprint}"
PATH_ROOT_FORMAT = "gems/%{gem}/pat... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/version.rb | app/models/version.rb | require "digest/sha2"
class Version < ApplicationRecord # rubocop:disable Metrics/ClassLength
RUBYGEMS_IMPORT_DATE = Date.parse("2009-07-25")
belongs_to :rubygem, touch: true
has_many :dependencies, lambda {
order(Rubygem.arel_table["name"].asc).includes(:rubygem).references(:rubygem... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/rubygem_transfer.rb | app/models/rubygem_transfer.rb | class RubygemTransfer < ApplicationRecord
enum :status, { pending: "pending", completed: "completed", failed: "failed" }, default: "pending"
belongs_to :organization
belongs_to :created_by, class_name: "User"
has_many :invites, as: :invitable, class_name: "OrganizationInvite", dependent: :destroy
has_many :... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/attestation.rb | app/models/attestation.rb | class Attestation < ApplicationRecord
belongs_to :version
validates :body, :media_type, presence: true
attribute :body, :jsonb
def sigstore_bundle
Sigstore::SBundle.new(
Sigstore::Bundle::V1::Bundle.decode_json_hash(body, registry: Sigstore::REGISTRY)
)
end
def display_data # rubocop:disabl... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/membership.rb | app/models/membership.rb | class Membership < ApplicationRecord
belongs_to :user
belongs_to :organization
belongs_to :invited_by, class_name: "User", optional: true
scope :unconfirmed, -> { where(confirmed_at: nil) }
scope :confirmed, -> { where.not(confirmed_at: nil) }
enum :role, { owner: Access::OWNER, admin: Access::ADMIN, mai... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/sendgrid_event.rb | app/models/sendgrid_event.rb | # frozen_string_literal: true
class SendgridEvent < ApplicationRecord
enum :status, %i[pending processed].index_with(&:to_s)
enum :event_type, %i[delivered dropped bounce].index_with(&:to_s)
# To make allowances for occasional inbox down time, this counts a maximum of one fail per day,
# e.g.:
#
# - If 2 ... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/linkset.rb | app/models/linkset.rb | class Linkset < ApplicationRecord
belongs_to :rubygem, inverse_of: :linkset
before_save :create_homepage_link_verification, if: :home_changed?
LINKS = %w[home code docs wiki mail bugs].freeze
LINKS.each do |url|
validates_formatting_of url.to_sym,
using: :url,
allow_nil: true,
allow_bla... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/organization_onboarding.rb | app/models/organization_onboarding.rb | class OrganizationOnboarding < ApplicationRecord
enum :name_type, { gem: "gem", user: "user" }, prefix: true, default: "gem"
enum :status, { pending: "pending", completed: "completed", failed: "failed" }, default: "pending"
has_many :invites, as: :invitable, class_name: "OrganizationInvite", dependent: :destroy
... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/gem_info.rb | app/models/gem_info.rb | class GemInfo
def initialize(rubygem_name, cached: true)
@rubygem_name = rubygem_name
@cached = cached
end
def compact_index_info
if @cached && (info = Rails.cache.read("info/#{@rubygem_name}"))
StatsD.increment "compact_index.memcached.info.hit"
info
else
StatsD.increment "comp... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/web_hook.rb | app/models/web_hook.rb | class WebHook < ApplicationRecord
GLOBAL_PATTERN = "*".freeze
TOO_MANY_FAILURES_DISABLED_REASON = "too many failures since the last success".freeze
FAILURE_DISABLE_THRESHOLD = 25
FAILURE_DISABLE_DURATION = 1.month
belongs_to :user
belongs_to :rubygem, optional: true
has_many :audits, as: :auditable, dep... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/feature_flag.rb | app/models/feature_flag.rb | class FeatureFlag
ORGANIZATIONS = :organizations
class << self
def enabled?(flag_name, actor = nil)
Flipper.enabled?(flag_name, actor)
end
def enable_globally(flag_name)
Flipper.enable(flag_name)
end
def disable_globally(flag_name)
Flipper.disable(flag_name)
end
def... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/gem_typo.rb | app/models/gem_typo.rb | class GemTypo
DOWNLOADS_THRESHOLD = 10_000
LAST_RELEASE_TIME = 5.years.ago
attr_reader :protected_gem
def initialize(rubygem_name)
@rubygem_name = rubygem_name
end
def protected_typo?
return false if GemTypoException.where("upper(name) = upper(?)", @rubygem_name).any?
return false if publi... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/version_manifest.rb | app/models/version_manifest.rb | # frozen_string_literal: true
class VersionManifest
DEFAULT_DIGEST = "sha256"
MAX_ENTRIES = 1000
attr_reader :version, :contents
delegate :gem, :fs, to: :contents
def initialize(gem:, number:, platform: nil)
platform = nil if platform == "ruby"
@version = [number, platform.presence].compact.join("... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/gem_typo_exception.rb | app/models/gem_typo_exception.rb | class GemTypoException < ApplicationRecord
validates :name, presence: true, uniqueness: { case_sensitive: false }, length: { maximum: Gemcutter::MAX_FIELD_LENGTH }
validate :rubygems_name
private
def rubygems_name
gem = Rubygem.new(name: name)
errors.add :name, "Rubygem validation failed: #{gem.errors... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/specification_policy.rb | app/models/specification_policy.rb | class SpecificationPolicy < Gem::SpecificationPolicy
def error(statement)
return if statement.start_with?("#{Gem::SpecificationPolicy::LAZY} is not a")
super
end
def warning(statement)
# do nothing
end
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/geoip_info.rb | app/models/geoip_info.rb | class GeoipInfo < ApplicationRecord
has_many :ip_addresses, dependent: :nullify
has_many :user_events, class_name: "Events::UserEvent", dependent: :nullify
has_many :rubygem_events, class_name: "Events::RubygemEvent", dependent: :nullify
validates :continent_code, :country_code, length: { maximum: 2 }
valida... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/api_key_rubygem_scope.rb | app/models/api_key_rubygem_scope.rb | class ApiKeyRubygemScope < ApplicationRecord
belongs_to :api_key
belongs_to :ownership
validates :ownership_id, uniqueness: { scope: :api_key_id }
validates :api_key, :ownership, presence: true
before_destroy :soft_delete_api_key!, if: :destroyed_by_association
private
def soft_delete_api_key!
api_k... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/application_model.rb | app/models/application_model.rb | class ApplicationModel
include ActiveModel::Model
include ActiveModel::Attributes
include ActiveModel::Serializers::JSON
include SemanticLogger::Loggable
# Taken from ActiveRecord::Base
concerning "Inspectable" do
included do
# Returns the contents of the record as a nicely formatted string.
... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/pusher.rb | app/models/pusher.rb | require "digest/sha2"
class Pusher
include TraceTagger
include SemanticLogger::Loggable
attr_reader :api_key, :spec, :spec_contents, :message, :code, :rubygem, :body, :version, :version_id, :size, :attestations
delegate :owner, to: :api_key
def initialize(api_key, body, request: nil, attestations: nil)
... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/oidc.rb | app/models/oidc.rb | module OIDC
def self.table_name_prefix
"oidc_"
end
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/webauthn_verification.rb | app/models/webauthn_verification.rb | class WebauthnVerification < ApplicationRecord
belongs_to :user
validates :user_id, uniqueness: true
validates :path_token, presence: true, uniqueness: true, length: { maximum: 128 }
validates :path_token_expires_at, presence: true
def expire_path_token
self.path_token_expires_at = 1.second.ago
save... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/log_ticket.rb | app/models/log_ticket.rb | class LogTicket < ApplicationRecord
enum :backend, { s3: 0, local: 1 }
enum :status, %i[pending processing failed processed].index_with(&:to_s)
def self.pop(key: nil, directory: nil)
scope = pending.limit(1).lock(true).order(:id)
scope = scope.where(key: key) if key
scope = scope.where(directory: dir... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/push_policy.rb | app/models/push_policy.rb | PushPolicy = Gem::Security::Policy.new(
"Push Policy",
verify_data: true,
verify_signer: true,
verify_chain: true,
verify_root: true,
only_trusted: false,
only_signed: false
)
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/application_record.rb | app/models/application_record.rb | class ApplicationRecord < ActiveRecord::Base
include SemanticLogger::Loggable
self.abstract_class = true
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/ip_address.rb | app/models/ip_address.rb | class IpAddress < ApplicationRecord
validates :ip_address, presence: true, uniqueness: true
validates :hashed_ip_address, presence: true, uniqueness: true
before_validation :hash_ip_address!
belongs_to :geoip_info, optional: true
has_many :user_events, class_name: "Events::UserEvent", dependent: :nullify
... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/organization.rb | app/models/organization.rb | class Organization < ApplicationRecord
include Events::Recordable
validates :handle, presence: true,
uniqueness: { case_sensitive: false },
length: { within: 2..40 },
format: { with: Patterns::HANDLE_PATTERN }
validates :name, presence: true, length: { within: 2..255 }
validate :handle_not_reserved... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/audit.rb | app/models/audit.rb | class Audit < ApplicationRecord
belongs_to :auditable, polymorphic: true
belongs_to :admin_github_user, class_name: "Admin::GitHubUser"
serialize :audited_changes, coder: JSON
validates :action, presence: true
validates :auditable, presence: false
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/deletion.rb | app/models/deletion.rb | class Deletion < ApplicationRecord
# we nullify the user when they delete their account
belongs_to :user, optional: true
belongs_to :version, inverse_of: :deletion
validates :user, presence: true, on: :create
validates :rubygem, :number, presence: true
validates :version, presence: true
validate :versio... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/gem_name_reservation.rb | app/models/gem_name_reservation.rb | class GemNameReservation < ApplicationRecord
validates :name, uniqueness: { case_sensitive: false }, presence: true, length: { maximum: Gemcutter::MAX_FIELD_LENGTH }
validate :downcase_name_check
has_many :audits, as: :auditable, inverse_of: :auditable, dependent: :nullify
def self.reserved?(name)
where(n... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/link_verification.rb | app/models/link_verification.rb | class LinkVerification < ApplicationRecord
belongs_to :linkable, polymorphic: true
MAX_FAILURES = 10
VALIDITY = 1.month
def self.verified
where(last_verified_at: VALIDITY.ago.beginning_of_day..)
end
def self.unverified
never_verified
.or(last_verified_before(VALIDITY.ago.beginning_of_day))
... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/ownership.rb | app/models/ownership.rb | class Ownership < ApplicationRecord
self.ignored_columns += %w[ownership_request_notifier]
belongs_to :rubygem
belongs_to :user
belongs_to :authorizer, class_name: "User"
has_many :api_key_rubygem_scopes, dependent: :destroy
validate :validate_unique_user
delegate :name, to: :user, prefix: :owner
del... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/api_key.rb | app/models/api_key.rb | class ApiKey < ApplicationRecord
class ScopeError < RuntimeError; end
API_SCOPES = %i[show_dashboard index_rubygems push_rubygem yank_rubygem add_owner update_owner remove_owner access_webhooks
configure_trusted_publishers].freeze
APPLICABLE_GEM_API_SCOPES = %i[push_rubygem yank_rubygem add_own... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/dependency.rb | app/models/dependency.rb | class Dependency < ApplicationRecord
belongs_to :rubygem, optional: true
belongs_to :version
has_one :version_rubygem, through: :version, source: :rubygem
before_validation :use_gem_dependency,
:use_existing_rubygem,
:parse_gem_dependency
validates :requirements, length: { maximum: Gemcutter::MAX_FI... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/admin.rb | app/models/admin.rb | module Admin
def self.table_name_prefix
"admin_"
end
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/feature_flag_actor.rb | app/models/feature_flag_actor.rb | class FeatureFlagActor
attr_reader :flipper_id, :record
def initialize(record)
@record = record
@flipper_id = record.flipper_id
end
def to_s
"#{record.handle} (#{record.class.name})"
end
def self.find(flipper_id)
type, handle = flipper_id.split(":")
actor = case type
when... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/webauthn_credential.rb | app/models/webauthn_credential.rb | class WebauthnCredential < ApplicationRecord
belongs_to :user
validates :external_id, uniqueness: true, presence: true, length: { maximum: 512 }
validates :public_key, presence: true, length: { maximum: 512 }
validates :nickname, presence: true, uniqueness: { scope: :user_id }, length: { maximum: 64 }
valida... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/links.rb | app/models/links.rb | class Links
include Enumerable
# Links available for indexed gems
LINKS = {
"home" => "homepage_uri",
"changelog" => "changelog_uri",
"code" => "source_code_uri",
"docs" => "documentation_uri",
"wiki" => "wiki_uri",
"mail" => "mailing_list_uri",
"bugs" =>... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/gem_download.rb | app/models/gem_download.rb | class GemDownload < ApplicationRecord
belongs_to :rubygem, optional: true
belongs_to :version, optional: true
scope(:most_downloaded_gems, -> { for_versions.includes(:version).order(count: :desc) })
scope(:for_versions, -> { where.not(version_id: 0) })
scope(:for_rubygems, -> { where(version_id: 0) })
scop... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/user.rb | app/models/user.rb | class User < ApplicationRecord
include Clearance::User
include Discard::Model
include Events::Recordable
include Gravtastic
include UserMultifactorMethods
is_gravtastic default: "retro"
self.discard_column = :deleted_at
default_scope { not_deleted }
before_save :_generate_confirmation_token_no_res... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/concerns/user_webauthn_methods.rb | app/models/concerns/user_webauthn_methods.rb | module UserWebauthnMethods
extend ActiveSupport::Concern
included do
has_many :webauthn_credentials, dependent: :destroy
has_one :webauthn_verification, dependent: :destroy
after_initialize do
self.webauthn_id ||= WebAuthn.generate_user_id
end
end
def webauthn_options_for_create
Web... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/concerns/user_totp_methods.rb | app/models/concerns/user_totp_methods.rb | module UserTotpMethods
extend ActiveSupport::Concern
def totp_enabled?
totp_seed.present?
end
def totp_disabled?
totp_seed.blank?
end
def disable_totp!
self.totp_seed = nil
reset_mfa_attributes if no_mfa_devices?
save!(validate: false)
Mailer.totp_disabled(id, Time.now.utc).deli... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/concerns/user_multifactor_methods.rb | app/models/concerns/user_multifactor_methods.rb | module UserMultifactorMethods
extend ActiveSupport::Concern
included do
include UserTotpMethods
include UserWebauthnMethods
attr_accessor :new_mfa_recovery_codes
enum :mfa_level, { disabled: 0, ui_only: 1, ui_and_api: 2, ui_and_gem_signin: 3 }, prefix: :mfa
validate :mfa_level_for_enabled_de... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/concerns/rubygem_searchable.rb | app/models/concerns/rubygem_searchable.rb | module RubygemSearchable
extend ActiveSupport::Concern
included do
searchkick index_name: Gemcutter::SEARCH_INDEX_NAME,
callbacks: false,
settings: {
number_of_shards: 1,
number_of_replicas: Gemcutter::SEARCH_NUM_REPLICAS,
analysis: {
analyzer: {
rubyge... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/organization/handle.rb | app/models/organization/handle.rb | class Organization::Handle
RESTFUL_ACTIONS = %w[
create
destroy
edit
index
new
show
update
].freeze
ROUTES = %w[
admin
api
dashboard
gems
invitation
invitations
members
memberships
onboarding
profile
settings
stats
teams
users
... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/user/with_private_fields.rb | app/models/user/with_private_fields.rb | # This enables us to return private fields, like mfa_level, to an authenticated user
# so that they may retrieve this information about their own profile without it
# being exposed to all users in their public profile
class User::WithPrivateFields < User
def payload
super.merge({ "mfa" => mfa_level, "warning" => ... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/admin/github_user.rb | app/models/admin/github_user.rb | class Admin::GitHubUser < ApplicationRecord
has_many :audits, inverse_of: :admin_github_user, foreign_key: :admin_github_user_id, dependent: :restrict_with_exception
scope :admins, -> { where(is_admin: true) }
# for avo
alias_attribute :name, :login
alias_attribute :avatar, :avatar_url
validate :valid_if... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/events/tag.rb | app/models/events/tag.rb | module Events::Tag
module_function
def additional_name(tag)
parts = tag.split(":")
parts.shift
:"#{parts.join('_').classify}Additional"
end
def const_name(tag)
parts = tag.split(":")
parts.shift
parts.map!(&:classify).join("::")
end
def translation_key(tag)
source, subject, *r... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/events/organization_event.rb | app/models/events/organization_event.rb | class Events::OrganizationEvent < ApplicationRecord
belongs_to :organization
include Events::Tags
CREATED = define_event "organization:created" do
attribute :name, :string
attribute :actor_gid, :global_id
end
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/events/rubygem_event.rb | app/models/events/rubygem_event.rb | class Events::RubygemEvent < ApplicationRecord
belongs_to :rubygem
include Events::Tags
VERSION_PUSHED = define_event "rubygem:version:pushed" do
attribute :number, :string
attribute :platform, :string
attribute :sha256, :string
attribute :pushed_by, :string
attribute :version_gid, :global... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/events/recordable.rb | app/models/events/recordable.rb | module Events::Recordable
extend ActiveSupport::Concern
def record_event!(tag, request: Current.request, **additional)
ip_address = request&.ip_address
geoip_info = ip_address&.geoip_info
if (user_agent = request&.user_agent.presence)
begin
user_agent_info = Gemcutter::UserAgentParser.ca... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/events/user_agent_info.rb | app/models/events/user_agent_info.rb | # frozen_string_literal: true
class Events::UserAgentInfo < ApplicationModel
attribute :installer, :string
attribute :device, :string
attribute :os, :string
attribute :user_agent, :string
attribute :implementation, :string
attribute :system, :string
def to_s
if installer == "Browser"
browser_n... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/events/user_event.rb | app/models/events/user_event.rb | class Events::UserEvent < ApplicationRecord
belongs_to :user, class_name: "::User"
include Events::Tags
LOGIN_SUCCESS = define_event "user:login:success" do
attribute :two_factor_method, :string
attribute :two_factor_label, :string
attribute :authentication_method, :string
end
EMAIL_SENT = defin... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/events/tags.rb | app/models/events/tags.rb | module Events::Tags
extend ActiveSupport::Concern
def additional_type
tags.fetch(tag, nil)
end
def additional
additional_type&.new(super) || super
end
def additional=(value)
super(value&.to_h)
end
included do
validates :tag, presence: true, inclusion: { in: ->(_) { tags.keys } }
... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/oidc/provider.rb | app/models/oidc/provider.rb | class OIDC::Provider < ApplicationRecord
validate :issuer_match, if: :configuration
before_validation -> { configuration&.expected_issuer = issuer }
validates :configuration, nested: true
validates :issuer, uniqueness: { ignore_case: true }
has_many :api_key_roles, class_name: "OIDC::ApiKeyRole", inverse_of... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/oidc/id_token.rb | app/models/oidc/id_token.rb | class OIDC::IdToken < ApplicationRecord
belongs_to :api_key_role, class_name: "OIDC::ApiKeyRole", foreign_key: :oidc_api_key_role_id, inverse_of: :id_tokens
belongs_to :api_key, inverse_of: :oidc_id_token
has_one :provider, through: :api_key_role, inverse_of: :id_tokens
has_one :user, through: :api_key_role, in... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/oidc/api_key_permissions.rb | app/models/oidc/api_key_permissions.rb | class OIDC::ApiKeyPermissions < ApplicationModel
def create_params(user)
params = { scopes: scopes }
params[:ownership] = gems&.first&.then { user.ownerships.joins(:rubygem).find_by!(rubygem: { name: it }) }
params[:expires_at] = DateTime.now.utc + valid_for
params
end
attribute :scopes, Types::A... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/oidc/trusted_publisher.rb | app/models/oidc/trusted_publisher.rb | module OIDC::TrustedPublisher
def self.table_name_prefix
"oidc_trusted_publisher_"
end
def self.all
[GitHubAction]
end
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/oidc/pending_trusted_publisher.rb | app/models/oidc/pending_trusted_publisher.rb | class OIDC::PendingTrustedPublisher < ApplicationRecord
belongs_to :user
belongs_to :trusted_publisher, polymorphic: true, optional: false
accepts_nested_attributes_for :trusted_publisher
validates :rubygem_name,
length: { maximum: Gemcutter::MAX_FIELD_LENGTH },
presence: true,
name_format: true,
... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/oidc/rubygem_trusted_publisher.rb | app/models/oidc/rubygem_trusted_publisher.rb | class OIDC::RubygemTrustedPublisher < ApplicationRecord
belongs_to :rubygem
belongs_to :trusted_publisher, polymorphic: true, optional: false
accepts_nested_attributes_for :trusted_publisher
validates :rubygem, uniqueness: { scope: %i[trusted_publisher_id trusted_publisher_type] }
def build_trusted_publish... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/oidc/api_key_role.rb | app/models/oidc/api_key_role.rb | class OIDC::ApiKeyRole < ApplicationRecord
belongs_to :provider, class_name: "OIDC::Provider", foreign_key: "oidc_provider_id", inverse_of: :api_key_roles
belongs_to :user, inverse_of: :oidc_api_key_roles
has_many :id_tokens, -> { order(created_at: :desc) },
class_name: "OIDC::IdToken", inverse_of: :api_key_... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/oidc/access_policy.rb | app/models/oidc/access_policy.rb | class OIDC::AccessPolicy < ApplicationModel
class Statement < ApplicationModel
def match_jwt?(jwt)
return false unless principal.oidc == jwt[:iss]
conditions.all? { it.match?(jwt) }
end
class Principal < ApplicationModel
attribute :oidc, :string
validates :oidc, presence: true
... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/oidc/trusted_publisher/github_action.rb | app/models/oidc/trusted_publisher/github_action.rb | class OIDC::TrustedPublisher::GitHubAction < ApplicationRecord
has_many :rubygem_trusted_publishers, class_name: "OIDC::RubygemTrustedPublisher", as: :trusted_publisher, dependent: :destroy,
inverse_of: :trusted_publisher
has_many :pending_trusted_publishers, class_name: "OIDC::PendingTrustedPublisher", as: :tr... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/models/rubygem_contents/entry.rb | app/models/rubygem_contents/entry.rb | # frozen_string_literal: true
class RubygemContents::Entry
class InvalidMetadata < RuntimeError; end
# Reading 262 bytes is (supposedly) enough to determine the mime type of the entry.
BYTES_FOR_MAGIC_DETECTION = 262
SIZE_LIMIT = 100.megabytes
MIME_TEXTUAL_SUBTYPES = %w[
text/
application/json
a... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/application_view.rb | app/views/application_view.rb | # frozen_string_literal: true
class ApplicationView < ApplicationComponent
# The ApplicationView is an abstract class for all your views.
# By default, it inherits from `ApplicationComponent`, but you
# can change that to `Phlex::HTML` if you want to keep views and
# components independent.
def title=(titl... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/application_component.rb | app/views/components/application_component.rb | # frozen_string_literal: true
class ApplicationComponent < Phlex::HTML
include Phlex::Rails::Helpers::Routes
extend PropInitializer::Properties
extend Phlex::Rails::HelperMacros
# Register Rails helpers that return HTML content
register_output_helper :icon_tag
register_output_helper :link_to
register_ou... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/alert_component.rb | app/views/components/alert_component.rb | # frozen_string_literal: true
class AlertComponent < ApplicationComponent
attr_reader :style, :closeable
def initialize(style: :notice, closeable: false)
super()
@style = style.to_sym
@style = :notice if @style == :notice_html
@style = :neutral unless STYLES.key?(@style)
@closeable = closeable... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/button_component.rb | app/views/components/button_component.rb | # frozen_string_literal: true
class ButtonComponent < ApplicationComponent
include Phlex::Rails::Helpers::LinkTo
include Phlex::Rails::Helpers::ButtonTo
attr_reader :args, :type, :options, :color, :size, :style
def initialize(*args, type: :button, size: :large, color: :primary, style: :fill, **options) # rub... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/card_component.rb | app/views/components/card_component.rb | # frozen_string_literal: true
class CardComponent < ApplicationComponent
include Phlex::Rails::Helpers::LinkTo
def view_template(&)
color = "bg-white dark:bg-black border border-neutral-200 dark:border-neutral-800 text-neutral-900 dark:text-white "
box = "w-full px-4 py-6 md:p-10 mb-10 rounded-md shadow o... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/onboarding/steps_component.rb | app/views/components/onboarding/steps_component.rb | # frozen_string_literal: true
class Onboarding::StepsComponent < ApplicationComponent
include Phlex::Rails::Helpers::LinkTo
def initialize(current_step)
@current_step = current_step
@steps = []
super()
end
def view_template(&)
vanish(&) if block_given?
nav(class: "mb-10 flex items-start ... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/version/provenance_component.rb | app/views/components/version/provenance_component.rb | # frozen_string_literal: true
class Version::ProvenanceComponent < ApplicationComponent
include Phlex::Rails::Helpers::LinkTo
prop :attestation
def view_template
display_data = @attestation.display_data
div(class: "gem__attestation", id: "gem__attestation") do
div(class: "gem__attestation__built... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/card/timeline_component.rb | app/views/components/card/timeline_component.rb | # frozen_string_literal: true
class Card::TimelineComponent < ApplicationComponent
include Phlex::Rails::Helpers::LinkTo
include Phlex::Rails::Helpers::ImageTag
include Phlex::Rails::Helpers::TimeAgoInWords
def view_template(&)
div(class: "flex grow ml-2 border-l-2 border-neutral-300") do
div(class:... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/table_details_component.rb | app/views/components/events/table_details_component.rb | class Events::TableDetailsComponent < ApplicationComponent
extend PropInitializer::Properties
prop :event, reader: :public
delegate :additional, :rubygem, to: :event
def view_template
raise NotImplementedError
end
def self.translation_path
super.gsub(/\.[^.]+\z/, "")
end
private
def link_... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/table_component.rb | app/views/components/events/table_component.rb | # frozen_string_literal: true
class Events::TableComponent < ApplicationComponent
include Phlex::Rails::Helpers::DistanceOfTimeInWordsToNow
include Phlex::Rails::Helpers::TimeTag
include Phlex::Rails::Helpers::DOMClass
extend Phlex::Rails::HelperMacros
register_value_helper :current_user
register_value_h... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/user_event/login/success_component.rb | app/views/components/events/user_event/login/success_component.rb | # frozen_string_literal: true
class Events::UserEvent::Login::SuccessComponent < Events::TableDetailsComponent
def view_template
if additional.authentication_method == "webauthn"
plain t(".webauthn_login", device: additional.two_factor_label)
elsif additional.two_factor_method.blank?
plain t(".mf... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/user_event/api_key/deleted_component.rb | app/views/components/events/user_event/api_key/deleted_component.rb | # frozen_string_literal: true
class Events::UserEvent::ApiKey::DeletedComponent < Events::TableDetailsComponent
def view_template
plain t(".api_key_name", name: event.additional.name)
end
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/user_event/api_key/created_component.rb | app/views/components/events/user_event/api_key/created_component.rb | # frozen_string_literal: true
class Events::UserEvent::ApiKey::CreatedComponent < Events::TableDetailsComponent
def view_template
div { t(".api_key_name", name: additional.name) }
div { t(".api_key_scopes", scopes: additional.scopes&.to_sentence) }
if additional.gem.present?
div do
t(".api_... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/user_event/user/created_component.rb | app/views/components/events/user_event/user/created_component.rb | # frozen_string_literal: true
class Events::UserEvent::User::CreatedComponent < Events::TableDetailsComponent
def view_template
plain t(".email", email: additional.email)
end
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/user_event/email/sent_component.rb | app/views/components/events/user_event/email/sent_component.rb | # frozen_string_literal: true
class Events::UserEvent::Email::SentComponent < Events::TableDetailsComponent
def view_template
plain t(".email_sent_subject", subject: additional.subject)
br
plain t(".email_sent_from", from: additional.from)
br
plain t(".email_sent_to", to: additional.to)
end
end... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/user_event/email/verified_component.rb | app/views/components/events/user_event/email/verified_component.rb | # frozen_string_literal: true
class Events::UserEvent::Email::VerifiedComponent < Events::TableDetailsComponent
def view_template
email = additional.email
return if email.blank?
code { plain email }
end
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/user_event/email/added_component.rb | app/views/components/events/user_event/email/added_component.rb | # frozen_string_literal: true
class Events::UserEvent::Email::AddedComponent < Events::TableDetailsComponent
def view_template
code { plain additional.email }
end
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/rubygem_event/version/unyanked_component.rb | app/views/components/events/rubygem_event/version/unyanked_component.rb | # frozen_string_literal: true
class Events::RubygemEvent::Version::UnyankedComponent < Events::TableDetailsComponent
def view_template
raw t(".version_html", version: link_to_version_from_gid(additional.version_gid, additional.number, additional.platform))
end
end
| ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/rubygem_event/version/pushed_component.rb | app/views/components/events/rubygem_event/version/pushed_component.rb | class Events::RubygemEvent::Version::PushedComponent < Events::TableDetailsComponent
delegate :rubygem, to: :event
def view_template
div do
t(".version_html", version:
link_to_version_from_gid(additional.version_gid, additional.number, additional.platform))
end
if additional.sha256.presen... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/rubygem_event/version/yank_forbidden_component.rb | app/views/components/events/rubygem_event/version/yank_forbidden_component.rb | # frozen_string_literal: true
class Events::RubygemEvent::Version::YankForbiddenComponent < Events::TableDetailsComponent
def view_template
div do
t(".version_html", version:
link_to_version_from_gid(additional.version_gid, additional.number, additional.platform))
end
return if additional.y... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/rubygem_event/version/yanked_component.rb | app/views/components/events/rubygem_event/version/yanked_component.rb | # frozen_string_literal: true
class Events::RubygemEvent::Version::YankedComponent < Events::TableDetailsComponent
def view_template
div do
t(".version_html", version:
link_to_version_from_gid(additional.version_gid, additional.number, additional.platform))
end
return if additional.yanked_b... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
rubygems/rubygems.org | https://github.com/rubygems/rubygems.org/blob/2b4f35acb8b13a47b00b24519359431f54aae073/app/views/components/events/rubygem_event/owner/added_component.rb | app/views/components/events/rubygem_event/owner/added_component.rb | # frozen_string_literal: true
class Events::RubygemEvent::Owner::AddedComponent < Events::TableDetailsComponent
def view_template
raw t(".owner_added_owner_html", owner: link_to_user_from_gid(additional.owner_gid, additional.owner))
return unless (authorizer = additional.authorizer.presence)
br
raw t... | ruby | MIT | 2b4f35acb8b13a47b00b24519359431f54aae073 | 2026-01-04T15:55:47.223680Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.