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 |
|---|---|---|---|---|---|---|---|---|
ViewComponent/view_component | https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/lib/view_component/base.rb | lib/view_component/base.rb | # frozen_string_literal: true
require "action_view"
require "view_component/collection"
require "view_component/compile_cache"
require "view_component/compiler"
require "view_component/config"
require "view_component/errors"
require "view_component/inline_template"
require "view_component/preview"
require "view_compon... | ruby | MIT | 48da443d2b0df16a981b7ec0cc4c6cf0a51114fb | 2026-01-04T15:50:14.216895Z | false |
ViewComponent/view_component | https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/lib/view_component/template.rb | lib/view_component/template.rb | # frozen_string_literal: true
module ViewComponent
class Template
DEFAULT_FORMAT = :html
private_constant :DEFAULT_FORMAT
DataWithSource = Struct.new(:format, :identifier, :short_identifier, :type, keyword_init: true)
attr_reader :details, :path
delegate :virtual_path, to: :@component
dele... | ruby | MIT | 48da443d2b0df16a981b7ec0cc4c6cf0a51114fb | 2026-01-04T15:50:14.216895Z | false |
ViewComponent/view_component | https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/lib/view_component/test_helpers.rb | lib/view_component/test_helpers.rb | # frozen_string_literal: true
module ViewComponent
module TestHelpers
begin
require "capybara/minitest"
include Capybara::Minitest::Assertions
def page
@page ||= Capybara::Node::Simple.new(rendered_content)
end
def refute_component_rendered
assert_no_selector("bod... | ruby | MIT | 48da443d2b0df16a981b7ec0cc4c6cf0a51114fb | 2026-01-04T15:50:14.216895Z | false |
ViewComponent/view_component | https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/lib/view_component/config.rb | lib/view_component/config.rb | # frozen_string_literal: true
require "view_component/deprecation"
module ViewComponent
class Config
class << self
# `new` without any arguments initializes the default configuration, but
# it's important to differentiate in case that's no longer the case in
# future.
alias_method :defau... | ruby | MIT | 48da443d2b0df16a981b7ec0cc4c6cf0a51114fb | 2026-01-04T15:50:14.216895Z | false |
ViewComponent/view_component | https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/lib/view_component/system_test_case.rb | lib/view_component/system_test_case.rb | # frozen_string_literal: true
require "active_support/test_case"
module ViewComponent
class SystemTestCase < ActionDispatch::SystemTestCase
include ViewComponent::SystemTestHelpers
def page
Capybara.current_session
end
end
end
| ruby | MIT | 48da443d2b0df16a981b7ec0cc4c6cf0a51114fb | 2026-01-04T15:50:14.216895Z | false |
ViewComponent/view_component | https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/lib/view_component/compile_cache.rb | lib/view_component/compile_cache.rb | # frozen_string_literal: true
module ViewComponent
# Keeps track of which templates have already been compiled
# This isn't part of the public API
module CompileCache
mattr_accessor :cache, instance_reader: false, instance_accessor: false do
Set.new
end
module_function
def register(klass)... | ruby | MIT | 48da443d2b0df16a981b7ec0cc4c6cf0a51114fb | 2026-01-04T15:50:14.216895Z | false |
ViewComponent/view_component | https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/lib/view_component/inline_template.rb | lib/view_component/inline_template.rb | # frozen_string_literal: true
module ViewComponent # :nodoc:
module InlineTemplate
extend ActiveSupport::Concern
Template = Struct.new(:source, :language, :path, :lineno)
class_methods do
def method_missing(method, *args)
return super if !method.end_with?("_template")
if defined?... | ruby | MIT | 48da443d2b0df16a981b7ec0cc4c6cf0a51114fb | 2026-01-04T15:50:14.216895Z | false |
ViewComponent/view_component | https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/lib/view_component/engine.rb | lib/view_component/engine.rb | # frozen_string_literal: true
require "rails"
require "view_component/config"
require "view_component/deprecation"
module ViewComponent
class Engine < Rails::Engine # :nodoc:
config.view_component = ViewComponent::Config.current
initializer "view_component.set_configs" do |app|
options = app.config.v... | ruby | MIT | 48da443d2b0df16a981b7ec0cc4c6cf0a51114fb | 2026-01-04T15:50:14.216895Z | false |
ViewComponent/view_component | https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/lib/view_component/instrumentation.rb | lib/view_component/instrumentation.rb | # frozen_string_literal: true
require "active_support/notifications"
module ViewComponent # :nodoc:
module Instrumentation
def self.included(mod)
mod.prepend(self) unless self <= ViewComponent::Instrumentation
end
def render_in(view_context, &block)
return super if !Rails.application.config... | ruby | MIT | 48da443d2b0df16a981b7ec0cc4c6cf0a51114fb | 2026-01-04T15:50:14.216895Z | false |
ViewComponent/view_component | https://github.com/ViewComponent/view_component/blob/48da443d2b0df16a981b7ec0cc4c6cf0a51114fb/lib/view_component/configurable.rb | lib/view_component/configurable.rb | # frozen_string_literal: true
module ViewComponent
module Configurable
extend ActiveSupport::Concern
class_methods do
def config
@_config ||= if respond_to?(:superclass) && superclass.respond_to?(:config)
superclass.config.inheritable_copy
else
ActiveSupport::Ordere... | ruby | MIT | 48da443d2b0df16a981b7ec0cc4c6cf0a51114fb | 2026-01-04T15:50:14.216895Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/add.rb | add.rb | # -----
# Input
# -----
# defaults
numbers =
[0b01000000000000001111111111111111,
0b01000000000000000000000000000000,
0b01000000000000000000000000000000,
0b01000000000000000000000000000000,
0b01000000000000000000000000000000,
]
# arguments passed
if ARGV.size >= 2
numbers = ARGV.map {|x| x.to_i(2)} # convert binary st... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/final.rb | final.rb | # coding: utf-8
require_relative "sha256lib.rb"
# -------
# Default
# -------
if !defined? $input
# default
$input = "abc"
# argument passed
$input = ARGV[0] if ARGV[0] # only accept strings for now
$message = $input.unpack("B*")[0] # 011000010110001001100011
$padded = padding($message)
$blocks = split($... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/hash256.rb | hash256.rb | require_relative "sha256lib.rb"
# ----------
# hash256.rb - The hash function used in Bitcoin. Basically just runs sha256.rb twice.
# ----------
# Command Line Arguments
$input = ARGV[0] || "0x0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/blocks.rb | blocks.rb | require_relative "sha256lib.rb"
# -------
# Default
# -------
if !defined? $input
# default
$input = "abc"
$message = $input.unpack("B*")[0]
# argument passed
$message = ARGV[0] if ARGV[0] # accept binary message string
# calculate padded message
$padded = padding($message)
end
# --------------
# Mess... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/compression.rb | compression.rb | # coding: utf-8
require_relative "sha256lib.rb"
# -------
# Default
# -------
if !defined? $input
$input = "abc"
$message = $input.unpack("B*")[0] # 011000010110001001100011
$padded = padding($message)
$blocks = split($padded, 512)
# message block
$block_number = 0 # message block number
$block = $block... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/ch.rb | ch.rb | # coding: utf-8
require_relative "sha256lib.rb"
# ------
# Choice
# ------
# Ch(x, y, z) = (x & y) ^ (~x & z)
#
# For each x bit:
# * If x is 1 choose y
# * If x is 0 choose z
# -----
# Input
# -----
# defaults
x = 0b00000000111111110000000011111111 # 0x428a2f98
y = 0b00000000000000001111111111111111 # 0x71374491... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/sigma0.rb | sigma0.rb | # coding: utf-8
require_relative "sha256lib.rb"
# -----
# σ0(x)
# -----
# σ0(x) = ROTR(7, x) ^ ROTR(18, x) ^ SHR(3, x)
# -----
# Input
# -----
# default
x = 0b00000000000000000011111111111111 # 0b11101001101101011101101110100101
# argument passed
x = ARGV[0].to_i(2) if ARGV[0] # binary
# check arguments
if ARGV[0] &&... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/t1.rb | t1.rb | # coding: utf-8
require_relative "sha256lib.rb"
# -------
# Default
# -------
if !defined? $input
$input = "abc"
$message = $input.unpack("B*")[0] # 011000010110001001100011
$padded = padding($message)
$blocks = split($padded, 512)
# message block
$block_number = 0 # message block number
$block = $block... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/xor.rb | xor.rb | # -----
# Input
# -----
# just do a simple XOR if binary string arguments passed
if ARGV.size >= 2
width = ARGV.map(&:size).max # work out the longest binary string (for display purposes)
system "clear"
ARGV.each do |binary|
puts binary.rjust(width, " ")
end
puts "-" * width
puts ARGV.map{|x| x.to_i(2)}.reduce(... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/expansion.rb | expansion.rb | # coding: utf-8
require_relative "sha256lib.rb"
# -------
# Default
# -------
if !defined? $input
# default
$input = "abc"
$message = $input.unpack("B*")[0] # 011000010110001001100011
$padded = padding($message)
$blocks = split($padded, 512)
$block_number = 0 # message block number
$block = ... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/shr.rb | shr.rb | # -----------
# Shift Right
# -----------
def shr(n, x)
x >> n
end
# -----
# Input
# -----
# defaults
x = 0b11111111000000001111111100000000 #0b11101001101101011101101110100101
n = 32
# arguments passed
x = ARGV[0].to_i(2) if ARGV[0] # binary
n = ARGV[1].to_i if ARGV[1] # integer
# check arguments
if ARGV[0]... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/padding.rb | padding.rb | require_relative "sha256lib.rb"
# -------
# Default
# -------
if !defined? $input
# default
$input = "abc"
$message = $input.unpack("B*")[0] # 011000010110001001100011
# argument passed
$message = ARGV[0] if ARGV[0] # accept binary message string
end
# -------
# Padding
# -------
# pad the message so that i... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/constants.rb | constants.rb | # coding: utf-8
require_relative "sha256lib.rb"
# ---------
# Constants - K
# ---------
# SHA256 uses the same sequence of sixty-four constant 32-bit words.
#
# These words represent the first thirty-two bits of the fractional parts of the cube roots of the first sixty-four prime numbers. These are "nothing up my slee... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/t2.rb | t2.rb | # coding: utf-8
require_relative "sha256lib.rb"
# -------
# Default
# -------
if !defined? $input
$input = "abc"
$message = $input.unpack("B*")[0] # 011000010110001001100011
$padded = padding($message)
$blocks = split($padded, 512)
# message block
$block_number = 0 # message block number
$block = $block... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/message.rb | message.rb | require_relative 'sha256lib.rb'
# -------
# Default
# -------
if !defined? $input
# default
$input = "abc"
$type = "string"
# argument passed
$input = ARGV[0] if ARGV[0] # only accept strings for now
# calculate message
$bytes = $input.bytes
$message = $input.bytes.map {|x| x.to_s(2).rjust(8, "0")}.join... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/initial.rb | initial.rb | require_relative "sha256lib.rb"
# -------------------
# Initial Hash Values - H0
# -------------------
# The first thirty-two bits of the fractional parts of the square roots of the first eight prime numbers.
#
# Why?
# * These initial values don't _need_ to be anything in particular.
# * These are random-looking, i... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/maj.rb | maj.rb | # coding: utf-8
require_relative "sha256lib.rb"
# --------
# Majority
# --------
# Maj(x, y, z) = (x & y) ^ (x & z) ^ (y & z)
#
# Use the majority of x, y, z to set the result bit.
# -----
# Input
# -----
# defaults
x = 0b00000000111111110000000011111111 # 0x428a2f98
y = 0b00000000000000001111111111111111 # 0x7137449... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/rotr.rb | rotr.rb | # -----------
# Shift Right
# -----------
def rotr(n, x)
mask = 2**32 - 1
right = (x >> n) & mask
left = (x << 32-n) & mask
result = right | left
return result
end
# -----
# Input
# -----
# defaults
x = 0b11111111000000001111111100000000 #0b11101001101101011101101110100101
n = 32
# arguments passed
x = ARGV... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/sigma1.rb | sigma1.rb | # coding: utf-8
require_relative "sha256lib.rb"
# -----
# σ1(x)
# -----
# σ1(x) = ROTR(17, x) ^ ROTR(19, x) ^ SHR(10, x)
# -----
# Input
# -----
# default
x = 0b00000000000000000011111111111111 # 0b11101001101101011101101110100101
# argument passed
x = ARGV[0].to_i(2) if ARGV[0] # binary
# check arguments
if ARGV[0] ... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/schedule.rb | schedule.rb | # coding: utf-8
require_relative "sha256lib.rb"
# -------
# Default
# -------
if !defined? $input
# default
$input = "abc"
$message = $input.unpack("B*")[0] # 011000010110001001100011
$padded = padding($message)
$blocks = split($padded, 512)
$block_number = 0 # message block number
$block = ... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/usigma1.rb | usigma1.rb | # coding: utf-8
require_relative "sha256lib.rb"
# -----
# Σ1(x)
# -----
# Σ1(x) = ROTR(6, x) ^ ROTR(11, x) ^ ROTR(25, x)
# -----
# Input
# -----
# default
x = 0b00000000000000000011111111111111 # 0b01010001000011100101001001111111
# argument passed
x = ARGV[0].to_i(2) if ARGV[0] # binary
# check arguments
if ARGV[0] ... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/usigma0.rb | usigma0.rb | # coding: utf-8
require_relative "sha256lib.rb"
# -----
# Σ0(x)
# -----
# Σ0(x) = ROTR(2, x) ^ ROTR(13, x) ^ ROTR(22, x)
# -----
# Input
# -----
# default
x = 0b00000000000000000011111111111111 # 0b11101001101101011101101110100101
# argument passed
x = ARGV[0].to_i(2) if ARGV[0] # binary
# check arguments
if ARGV[0] ... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/sha256lib.rb | sha256lib.rb | # =======
# SHA-256
# =======
# -----
# Utils - Handy functions for converting integers and strings to binary
# -----
# Convert integer to binary string (32 bits)
def bits(x, n = 32)
if x >= 0
return "%0#{n}b" % x
else
# Note: Ruby NOT function returns a negative number, and .to_s(2) displays this mathemat... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
in3rsha/sha256-animation | https://github.com/in3rsha/sha256-animation/blob/871e976d69e66474ef5239ee82031b7d87cbcafc/sha256.rb | sha256.rb | require_relative "sha256lib.rb"
# -------
# Default
# -------
if !defined? $input
# Command Line Arguments
$input = ARGV[0] || "abc" # "string"|"0xaabbcc"|"0b10110100"
$delay = ARGV[1] || "normal" # [enter|normal|fast|nodelay]
# Detect input type (binary, hex, or string)
$type = input_type($input)
# R... | ruby | MIT | 871e976d69e66474ef5239ee82031b7d87cbcafc | 2026-01-04T15:50:35.668939Z | false |
plusjade/jekyll-bootstrap | https://github.com/plusjade/jekyll-bootstrap/blob/cb04bc5e0c7f84deb42ccae92286400f8d67d9b2/_plugins/debug.rb | _plugins/debug.rb | # A simple way to inspect liquid template variables.
# Usage:
# Can be used anywhere liquid syntax is parsed (templates, includes, posts/pages)
# {{ site | debug }}
# {{ site.posts | debug }}
#
require 'pp'
module Jekyll
# Need to overwrite the inspect method here because the original
# uses < > to encapsulate t... | ruby | MIT | cb04bc5e0c7f84deb42ccae92286400f8d67d9b2 | 2026-01-04T15:50:53.536694Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/app/controllers/concerns/high_voltage/static_page.rb | app/controllers/concerns/high_voltage/static_page.rb | module HighVoltage::StaticPage
extend ActiveSupport::Concern
included do
layout ->(_) { HighVoltage.layout }
rescue_from ActionView::MissingTemplate do |exception|
if exception.message =~ %r{Missing template #{page_finder.content_path}}
invalid_page
else
raise exception
e... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/app/controllers/high_voltage/pages_controller.rb | app/controllers/high_voltage/pages_controller.rb | class HighVoltage::PagesController < ApplicationController
include HighVoltage::StaticPage
end
| ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/fake_app.rb | spec/fake_app.rb | class ApplicationController < ActionController::Base
protect_from_forgery
end
# Create a rails app
module Dummy
class Application < Rails::Application
config.secret_key_base = "test"
config.eager_load = false
config.action_controller.perform_caching = true
config.action_controller.cache_store = :me... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/high_voltage_spec.rb | spec/high_voltage_spec.rb | require 'minimal_spec_helper'
describe HighVoltage do
it 'is valid' do
expect(HighVoltage).to be_a(Module)
end
it 'is loadable without preloading rails' do
expect { require 'high_voltage' }.not_to raise_error
end
end
| ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/spec_helper.rb | spec/spec_helper.rb | ENV["RAILS_ENV"] = "test"
require "pry"
require "logger"
require "active_model/railtie"
require "action_controller/railtie"
require "action_view/railtie"
require "high_voltage"
require "fake_app"
require "rspec/rails"
Rails.backtrace_cleaner.remove_silencers!
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each { |... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/minimal_spec_helper.rb | spec/minimal_spec_helper.rb | RSpec.configure do |config|
require 'rspec/expectations'
config.include RSpec::Matchers
config.mock_with :rspec
end
| ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/support/app/controllers/subclassed_pages_controller.rb | spec/support/app/controllers/subclassed_pages_controller.rb | class SubclassedPagesController < HighVoltage::PagesController
layout 'alternate'
end
| ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/support/app/controllers/alternative_finder_controller.rb | spec/support/app/controllers/alternative_finder_controller.rb | class AlternativeFinderController < HighVoltage::PagesController
private
def page_finder_factory
Rot13PageFinder
end
class Rot13PageFinder < HighVoltage::PageFinder
def find
paths = super.split('/')
"#{paths[0..-2].join('/')}/#{paths[-1].tr('a-z','n-za-m')}"
end
end
end
| ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/integration/navigation_spec.rb | spec/integration/navigation_spec.rb | require 'spec_helper'
describe 'Navigation' do
it 'is a valid app' do
expect(::Rails.application).to be_a(Dummy::Application)
end
end
| ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/routing/routes_spec.rb | spec/routing/routes_spec.rb | require 'spec_helper'
describe 'routes' do
context 'default configuration' do
it 'generates a route' do
expect(page_path('one')).to eq '/pages/one'
end
it 'generates a nested route' do
expect(page_path('one/two')).to eq '/pages/one/two'
end
it 'recognizes a route' do
assert_re... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/requests/home_page_spec.rb | spec/requests/home_page_spec.rb | require 'spec_helper'
describe 'Home page route' do
before(:each) do
HighVoltage.home_page = 'home'
Rails.application.reload_routes!
end
it 'redirects the duplicate content to root' do
get '/home'
expect(response.headers['Location']).to eq 'http://www.example.com/'
end
end
| ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/fixtures/config/routes.rb | spec/fixtures/config/routes.rb | Dummy::Application.routes.draw do
get "/subclassed_pages/*id" => 'subclassed_pages#show', :format => false
get "/alternative_finder/*id" => 'alternative_finder#show', :format => false
end
| ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/controllers/alternative_finder_controller_spec.rb | spec/controllers/alternative_finder_controller_spec.rb | require 'spec_helper'
describe AlternativeFinderController do
render_views
it 'renders the file from the alternative directory' do
get :show, params: { id: 'ebg13' }
expect(response).to be_successful
expect(response).to render_template('rot13')
end
end
| ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/controllers/subclassed_pages_controller_spec.rb | spec/controllers/subclassed_pages_controller_spec.rb | require "spec_helper"
describe SubclassedPagesController do
render_views
describe "on GET to /subclassed_pages/also_exists" do
before { get :show, params: { id: "also_exists" } }
it "responds with success and render template" do
expect(response).to be_successful
expect(response).to render_tem... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/controllers/pages_controller_spec.rb | spec/controllers/pages_controller_spec.rb | # encoding: utf-8
require "spec_helper"
describe HighVoltage::PagesController do
render_views
context "using default configuration" do
describe "on GET to /pages/exists" do
before { get :show, params: { id: "exists" } }
it "responds with success and render template" do
expect(response).t... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/features/view_page_spec.rb | spec/features/view_page_spec.rb | require "spec_helper"
feature "view page" do
scenario "successfully" do
visit page_path(id: "about")
expect(page).to have_content "About Us"
end
end
| ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/features/current_page_helper_spec.rb | spec/features/current_page_helper_spec.rb | require "spec_helper"
feature "current page helper" do
scenario "is available in view" do
visit page_path(id: "current_page_helper")
expect(page).to have_content "Current Page: pages/current_page_helper"
end
end
| ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/high_voltage/page_spec.rb | spec/high_voltage/page_spec.rb | require "spec_helper"
describe HighVoltage::Page do
it "produces the id for a page" do
page = page(full_file_path("exists.html.erb"))
expect(page.id).to eq "exists"
end
it "produces the id for a page in a subdirectory" do
page = page(full_file_path("dir/nested.html.erb"))
expect(page.id).to eq... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/high_voltage/configuration_spec.rb | spec/high_voltage/configuration_spec.rb | require 'minimal_spec_helper'
describe HighVoltage::Configuration do
describe 'basic config assignment' do
let(:config_value) { 'fake_config_value' }
before(:each) do
HighVoltage.configure do |config|
config.content_path = config_value
config.layout = config_value
config.parent... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/high_voltage/page_collector_spec.rb | spec/high_voltage/page_collector_spec.rb | require "spec_helper"
describe HighVoltage::PageCollector do
it "produces an array of all page_ids under pages/" do
expect(HighVoltage.page_ids).to match_array [
"about",
"also_dir/also_nested",
"also_exists",
"also_exists_but_references_nonexistent_partial",
"current_page_helper",
... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/high_voltage/page_finder_spec.rb | spec/high_voltage/page_finder_spec.rb | # encoding: utf-8
require "spec_helper"
describe HighVoltage::PageFinder do
it "produces the name of an existing template" do
expect(find("existing")).to eq "pages/existing"
end
it "produces the name of a nested template" do
expect(find("dir/nested")).to eq "pages/dir/nested"
end
it "produces the ... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/spec/constraints/root_route_spec.rb | spec/constraints/root_route_spec.rb | require "spec_helper"
describe HighVoltage::Constraints::RootRoute do
describe "#matches?" do
it "returns true when the view file exists" do
request = double(path: "exists")
result = described_class.new.matches?(request)
expect(result).to be true
end
it "returns true when the view fi... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/lib/high_voltage.rb | lib/high_voltage.rb | require 'active_support/core_ext/string'
require 'active_support/core_ext/module/attribute_accessors'
require 'high_voltage/configuration'
require 'high_voltage/constraints/root_route'
require "high_voltage/page"
require "high_voltage/page_collector"
require 'high_voltage/page_finder'
require 'high_voltage/route_drawe... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/lib/high_voltage/page_finder.rb | lib/high_voltage/page_finder.rb | module HighVoltage
# A command for finding pages by id. This encapsulates the concepts of
# mapping page names to file names.
class PageFinder
def initialize(page_id)
@page_id = page_id
end
# Produce a template path to the page, in a format understood by
# `render :template => find`
def... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/lib/high_voltage/version.rb | lib/high_voltage/version.rb | module HighVoltage
VERSION = "5.0.0".freeze
end
| ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/lib/high_voltage/page.rb | lib/high_voltage/page.rb | module HighVoltage
class Page
attr_reader :content_path, :file_path
def initialize(content_path, file_path)
@content_path = content_path
@file_path = file_path
end
def id
file_path.gsub(content_path, "").split(".").first
end
def valid?
exists? && file_in_content_path... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/lib/high_voltage/configuration.rb | lib/high_voltage/configuration.rb | module HighVoltage
module Configuration
attr_accessor(
:content_path,
:home_page,
:layout,
:parent_engine,
:route_drawer,
:routes,
)
def configure
yield self
end
def self.extended(base)
base.set_default_configuration
end
def page_ids
... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/lib/high_voltage/engine.rb | lib/high_voltage/engine.rb | module HighVoltage
class Engine < Rails::Engine
initializer "Set up default parent engine" do |app|
HighVoltage.parent_engine ||= Rails.application
end
initializer "Require concerns path" do |app|
concerns_path = "app/controllers/concerns"
unless app.paths.keys.include?(concerns_path)
... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/lib/high_voltage/page_collector.rb | lib/high_voltage/page_collector.rb | module HighVoltage
require "find"
class PageCollector
attr_reader :content_path
def initialize(content_path)
@content_path = content_path.to_s
end
def page_ids
pages.select(&:valid?).map(&:id)
end
private
def pages
Find.find(content_path).map do |file_path|
... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/lib/high_voltage/route_drawers/default.rb | lib/high_voltage/route_drawers/default.rb | module HighVoltage
module RouteDrawers
# Matches routes in the HighVoltage.content_path directory. By default this looks
# for /pages/id. e.g. http://www.example.com/pages/about_us
class Default
def self.match_attributes
{
"/#{HighVoltage.content_path}*id" => 'high_voltage/pages#sh... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/lib/high_voltage/route_drawers/root.rb | lib/high_voltage/route_drawers/root.rb | module HighVoltage
module RouteDrawers
# Matches routes from root of the domain e.g. http://www.example.com/about_us
# Uses HighVoltage::Constraints::RootRoute to validate view exists.
class Root
def self.match_attributes
{
"/*id" => 'high_voltage/pages#show',
:as => :pag... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/lib/high_voltage/constraints/root_route.rb | lib/high_voltage/constraints/root_route.rb | module HighVoltage
module Constraints
# Routing constraint to validate request.path has a corresponding view
class RootRoute
def initialize
@lookup_context = ActionView::LookupContext.new(
Rails.configuration.paths["app/views"],
)
end
def matches?(request)
... | ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
thoughtbot/high_voltage | https://github.com/thoughtbot/high_voltage/blob/7e8e6219ca19024759f2991149f98404435a7fdb/config/routes.rb | config/routes.rb | HighVoltage.parent_engine.routes.draw do
if HighVoltage.home_page
get "/#{HighVoltage.home_page}", to: redirect('/')
root to: 'high_voltage/pages#show', id: HighVoltage.home_page
end
if HighVoltage.routes
get **HighVoltage.route_drawer.match_attributes
end
end
| ruby | MIT | 7e8e6219ca19024759f2991149f98404435a7fdb | 2026-01-04T15:50:54.796399Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/gem_rake_helper.rb | gem_rake_helper.rb | require 'bundler/setup'
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'yard'
# Skip the releasing tag
class Bundler::GemHelper
def version_tag
version.to_s
end
end
Rake::TestTask.new(:test) do |test|
test.libs << 'test'
test.libs << '../padrino/test'
test.test_files = Dir['test/**/test_*.r... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/test/test_locale.rb | padrino-admin/test/test_locale.rb | require_relative 'helper'
describe 'Filters' do
Dir[File.expand_path('../lib/padrino-admin/locale/admin/*.yml', __dir__)].each do |file|
name = File.basename(file, '.yml')
it "should have a vaild #{name} locale for admin" do
base = YAML.load_file(file)
base = base[name]['padrino']['admin']
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/test/helper.rb | padrino-admin/test/helper.rb | ENV['RACK_ENV'] = 'test'
PADRINO_ROOT = __dir__ unless defined? PADRINO_ROOT
require 'minitest/autorun'
require 'minitest/pride'
require 'rack/test'
require 'thor/group'
require 'sequel/model'
require 'padrino-admin'
require 'ext/minitest-spec'
require 'ext/rack-test-methods'
require 'mocha/minitest'
Padrino::Genera... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/test/test_admin_application.rb | padrino-admin/test/test_admin_application.rb | require_relative 'helper'
describe 'AdminApplication' do
def setup
load_fixture 'sequel'
end
describe 'session id setting' do
it "should provide it if it doesn't exist" do
mock_app do
set :app_name, 'session_id_tester'
register Padrino::Admin::AccessControl
end
assert_... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/test/fixtures/sequel.rb | padrino-admin/test/fixtures/sequel.rb | require 'digest/sha1'
require 'sequel'
require 'sequel/extensions/migration'
Sequel::Model.db =
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
require 'jdbc/sqlite3'
Sequel.connect('jdbc:sqlite::memory:')
else
require 'sqlite3'
Sequel.sqlite(':memory:')
end
migration = Sequel.migration do
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/test/generators/test_admin_app_generator.rb | padrino-admin/test/generators/test_admin_app_generator.rb | require_relative '../helper'
describe 'AdminAppGenerator' do
before do
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
end
after do
`rm -rf #{@apptmp}`
end
describe 'the admin app generator' do
before do
# Account gets created by Datamapper's migratio... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/test/generators/test_admin_page_generator.rb | padrino-admin/test/generators/test_admin_page_generator.rb | require_relative '../helper'
require_relative '../fixtures/sequel'
describe 'AdminPageGenerator' do
before do
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
end
after do
`rm -rf #{@apptmp}`
end
describe 'the admin page generator' do
it 'should fail outside... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/test/generators/test_account_model_generator.rb | padrino-admin/test/generators/test_account_model_generator.rb | require_relative '../helper'
describe 'AccountModelGenerator' do
before do
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
`mkdir -p #{@apptmp}`
end
after do
%(rm -rf #{@apptmp})
end
describe 'activerecord' do
before do
capture_io { generate(:project, 'sample_project', '-e... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/lib/padrino-admin.rb | padrino-admin/lib/padrino-admin.rb | require 'padrino-core'
require 'padrino-helpers'
FileSet.glob_require('padrino-admin/*.rb', __FILE__)
FileSet.glob_require('padrino-admin/{helpers,utils}/*.rb', __FILE__)
module Padrino
##
# Padrino::Admin is beautiful Ajax Admin, with these features:
#
# Orm Agnostic:: Adapters for datamapper, activerecord, ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/lib/padrino-admin/access_control.rb | padrino-admin/lib/padrino-admin/access_control.rb | module Padrino
module Admin
class AccessControlError < StandardError
end
##
# This module enables access control functionality within a Padrino application.
#
module AccessControl
class << self
##
# Method used by Padrino::Application when we register the extension.
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/lib/padrino-admin/helpers/view_helpers.rb | padrino-admin/lib/padrino-admin/helpers/view_helpers.rb | module Padrino
module Admin
module Helpers
module ViewHelpers
##
# Icon's Bootstrap helper.
#
# @param [Symbol] icon
# The specified icon type.
#
# @param [Symbol] tag
# The HTML tag.
#
# @return [String] HTML tag with prepen... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/lib/padrino-admin/helpers/authentication_helpers.rb | padrino-admin/lib/padrino-admin/helpers/authentication_helpers.rb | module Padrino
module Admin
module Helpers
##
# Common helpers used for authorization within an application.
#
module AuthenticationHelpers
##
# Returns true if +current_account+ is logged and active.
#
def logged_in?
!current_account.nil?
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/lib/padrino-admin/generators/admin_app.rb | padrino-admin/lib/padrino-admin/generators/admin_app.rb | module Padrino
module Generators
##
# Defines the generator for creating a new admin app.
#
class AdminApp < Thor::Group
# Add this generator to our padrino-gen
Padrino::Generators.add_generator(:admin, self)
# Define the source template root
def self.source_root; __dir__; end... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/lib/padrino-admin/generators/actions.rb | padrino-admin/lib/padrino-admin/generators/actions.rb | module Padrino
module Generators
##
# Generator action definitions for the admin panel.
#
module Admin
##
# Important tasks for setting up or configuring the admin application.
#
module Actions
##
# Tell us which orm we are using.
#
def orm
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/lib/padrino-admin/generators/orm.rb | padrino-admin/lib/padrino-admin/generators/orm.rb | module Padrino
module Admin
##
# Contains all admin related generator functionality.
#
module Generators
# Defines a generic exception for the admin ORM handler.
class OrmError < StandardError; end
##
# Defines the generic ORM management functions used to manipulate data for a... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-admin/lib/padrino-admin/generators/admin_page.rb | padrino-admin/lib/padrino-admin/generators/admin_page.rb | module Padrino
module Generators
##
# Defines the generator for creating a new admin page.
#
class AdminPage < Thor::Group
attr_accessor :default_orm
# Add this generator to our padrino-gen.
Padrino::Generators.add_generator(:admin_page, self)
# Define the source template roo... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_application.rb | padrino-core/test/test_application.rb | require_relative 'helper'
class PadrinoPristine < Padrino::Application; end
class PadrinoTestApp < Padrino::Application; end
class PadrinoTestApp2 < Padrino::Application; end
describe 'Application' do
before { Padrino.clear! }
describe 'for application functionality' do
it 'should check default options' do
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_core.rb | padrino-core/test/test_core.rb | require_relative 'helper'
describe 'Core' do
def setup
Padrino.clear!
end
describe 'for core functionality' do
it 'should check some global methods' do
assert_respond_to Padrino, :root
assert_respond_to Padrino, :env
assert_respond_to Padrino, :application
assert_respond_to Padri... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_params_protection.rb | padrino-core/test/test_params_protection.rb | require_relative 'helper'
describe 'Padrino::ParamsProtection' do
before do
@teri = { 'name' => 'Teri Bauer', 'position' => 'baby' }
@kim = { 'name' => 'Kim Bauer', 'position' => 'daughter', 'child' => @teri }
@jack = { 'name' => 'Jack Bauer', 'position' => 'terrorist', 'child' => @kim }
@family = { ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_reloader_system.rb | padrino-core/test/test_reloader_system.rb | require_relative 'helper'
require_relative 'fixtures/apps/kiq'
require_relative 'fixtures/apps/system'
require_relative 'fixtures/apps/static'
require_relative 'fixtures/apps/custom_dependencies/custom_dependencies'
describe 'SystemReloader' do
describe 'for wierd and difficult reload events' do
before do
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_reloader_complex.rb | padrino-core/test/test_reloader_complex.rb | require_relative 'helper'
require_relative 'fixtures/apps/complex'
describe 'ComplexReloader' do
describe 'for complex reload functionality' do
before do
Padrino.clear!
Padrino.mount('complex_1_demo').to('/complex_1_demo')
Padrino.mount('complex_2_demo').to('/complex_2_demo')
end
it 's... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_router.rb | padrino-core/test/test_router.rb | require_relative 'helper'
require_relative 'fixtures/apps/simple'
describe 'Router' do
def setup
Padrino.clear!
end
it 'should dispatch paths correctly' do
app = lambda { |env|
[200, {
'X-ScriptName' => env['SCRIPT_NAME'],
'X-PathInfo' => env['PATH_INFO'],
'Content-Type' =>... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_reloader_simple.rb | padrino-core/test/test_reloader_simple.rb | require_relative 'helper'
require_relative 'fixtures/apps/simple'
describe 'SimpleReloader' do
describe 'for simple reset functionality' do
it 'should reset routes' do
mock_app do
(1..10).each do |i|
get("/#{i}") { "Foo #{i}" }
end
end
(1..10).each do |i|
get ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_restful_routing.rb | padrino-core/test/test_restful_routing.rb | require_relative 'helper'
describe 'Routing' do
it 'should perform restul routing' do
mock_app do
controller parent: :parents do
get :index, with: :asset_id do
"#{url_for(:index, params[:parent_id], asset_id: params[:asset_id])} get"
end
put :index, with: :asset_id do
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_dependencies.rb | padrino-core/test/test_dependencies.rb | require_relative 'helper'
describe 'Dependencies' do
describe 'when we require a dependency that have another dependency' do
before do
@log_level = Padrino::Logger::Config[:test]
@io = StringIO.new
Padrino::Logger::Config[:test] = { log_level: :error, stream: @io }
Padrino::Logger.setup!
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_locale.rb | padrino-core/test/test_locale.rb | require_relative 'helper'
describe 'Locales' do
Dir[File.expand_path('../lib/padrino-core/locale/*.yml', __dir__)].each do |file|
base_original = YAML.load_file(file)
name = File.basename(file, '.yml')
it "should should have correct locale for #{name}" do
base = base_original[name]['date']['formats... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_csrf_protection.rb | padrino-core/test/test_csrf_protection.rb | require_relative 'helper'
describe 'Application' do
before { Padrino.clear! }
describe 'CSRF protection' do
describe 'with CSRF protection on' do
before do
@token =
begin
Rack::Protection::AuthenticityToken.random_token
rescue StandardError
'a_token'
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_reloader_storage.rb | padrino-core/test/test_reloader_storage.rb | require_relative 'helper'
describe 'Padrino::Reloader::Storage' do
describe '#classes' do
it 'should take an snapshot of the current loaded classes' do
snapshot = Padrino::Reloader::Storage.send(:object_classes)
assert_equal snapshot.include?(Padrino::Logger), true
end
it 'should return a Se... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_filters.rb | padrino-core/test/test_filters.rb | require_relative 'helper'
describe 'Filters' do
it 'should filters by accept header' do
mock_app do
get '/foo', provides: %i[xml js] do
request.env['HTTP_ACCEPT']
end
end
get '/foo', {}, { 'HTTP_ACCEPT' => 'application/xml' }
assert ok?
assert_equal 'application/xml', body
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/helper.rb | padrino-core/test/helper.rb | ENV['RACK_ENV'] = 'test'
PADRINO_ROOT = __dir__ unless defined?(PADRINO_ROOT)
require 'minitest/autorun'
require 'minitest/pride'
require 'i18n'
require 'json'
require 'builder'
require 'rack/test'
require 'yaml'
require 'padrino-core'
require 'ext/minitest-spec'
require 'ext/rack-test-methods'
class Minitest::Spec
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_reloader_external.rb | padrino-core/test/test_reloader_external.rb | require_relative 'helper'
require_relative 'fixtures/reloadable_apps/main/app'
describe 'ExternalReloader' do
describe 'for external app' do
before do
Padrino.clear!
Padrino.mount('ReloadableApp::External').to('/reloadable/external')
Padrino.mount('ReloadableApp::Main').to('/reloadable')
... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | false |
padrino/padrino-framework | https://github.com/padrino/padrino-framework/blob/a079eae8d9eda238cfdb131d197493d2f919c715/padrino-core/test/test_routing.rb | padrino-core/test/test_routing.rb | require_relative 'helper'
class FooError < RuntimeError; end
class RegexpLookAlike
# RegexpLookAlike#to_s, RegexpLookAlike#names and MatchData#names must be defined.
class MatchData
def captures
%w[this is a test]
end
def names
%w[one two three four]
end
end
def names
%w[one ... | ruby | MIT | a079eae8d9eda238cfdb131d197493d2f919c715 | 2026-01-04T15:50:33.574154Z | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.