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 |
|---|---|---|---|---|---|---|---|---|
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/id_selector.rb | lib/scss_lint/linter/id_selector.rb | module SCSSLint
# Checks for the use of an ID selector.
class Linter::IdSelector < Linter
include LinterRegistry
def visit_id(id)
add_lint(id, 'Avoid using id selectors')
end
end
end
| ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/indentation.rb | lib/scss_lint/linter/indentation.rb | module SCSSLint
# Checks for consistent indentation of nested declarations and rule sets.
class Linter::Indentation < Linter # rubocop:disable Metrics/ClassLength
include LinterRegistry
def visit_root(_node)
@indent_width = config['width'].to_i
@indent_character = config['character'] || 'space'... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/declaration_order.rb | lib/scss_lint/linter/declaration_order.rb | # frozen_string_literal: true
module SCSSLint
# Checks the order of nested items within a rule set.
class Linter::DeclarationOrder < Linter
include LinterRegistry
def check_order(node)
check_node(node)
yield # Continue linting children
end
alias visit_rule check_order
alias visit_... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/space_between_parens.rb | lib/scss_lint/linter/space_between_parens.rb | module SCSSLint
# Checks for the presence of spaces between parentheses.
class Linter::SpaceBetweenParens < Linter
include LinterRegistry
def check_node(node)
check(node, source_from_range(node.source_range))
yield
end
alias visit_atroot check_node
alias visit_cssimport check_node
... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/length_variable.rb | lib/scss_lint/linter/length_variable.rb | module SCSSLint
# Ensures length literals are used only in variable declarations.
class Linter::LengthVariable < Linter
include LinterRegistry
LENGTH_UNITS = [
'ch', 'em', 'ex', 'rem', # Font-relative lengths
'cm', 'in', 'mm', 'pc', 'pt', 'px', 'q', # Absolute lengths
'vh'... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/qualifying_element.rb | lib/scss_lint/linter/qualifying_element.rb | module SCSSLint
# Checks for element selectors qualifying id, classes, or attribute selectors.
class Linter::QualifyingElement < Linter
include LinterRegistry
def visit_simple_sequence(seq)
return unless seq_contains_sel_class?(seq, Sass::Selector::Element)
check_id(seq) unless config['allow_el... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/extend_directive.rb | lib/scss_lint/linter/extend_directive.rb | module SCSSLint
# Checks that `@extend` is never used.
class Linter::ExtendDirective < Linter
include LinterRegistry
def visit_extend(node)
add_lint(node, 'Do not use the `@extend` directive (`@include` a `@mixin` ' \
'instead)')
end
end
end
| ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/trailing_zero.rb | lib/scss_lint/linter/trailing_zero.rb | module SCSSLint
# Checks for unnecessary trailing zeros in numeric values with decimal points.
class Linter::TrailingZero < Linter
include LinterRegistry
def visit_script_string(node)
return unless node.type == :identifier
non_string_values = remove_quoted_strings(node.value).split
non_s... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/space_after_comment.rb | lib/scss_lint/linter/space_after_comment.rb | module SCSSLint
# Checks for a space after comment literals
class Linter::SpaceAfterComment < Linter
include LinterRegistry
def visit_comment(node)
source = source_from_range(node.source_range).strip
check_method = "check_#{node.type}_comment"
send(check_method, node, source)
end
p... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/nesting_depth.rb | lib/scss_lint/linter/nesting_depth.rb | module SCSSLint
# Checks for rule sets nested deeper than a specified maximum depth.
class Linter::NestingDepth < Linter
include LinterRegistry
IGNORED_SELECTORS = [Sass::Selector::Parent, Sass::Selector::Pseudo].freeze
def visit_root(_node)
@max_depth = config['max_depth']
@depth = 1
... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/bem_depth.rb | lib/scss_lint/linter/bem_depth.rb | module SCSSLint
# Checks for BEM selectors with more elements than a specified maximum number.
class Linter::BemDepth < Linter
include LinterRegistry
def visit_root(_node)
@max_elements = config['max_elements']
yield # Continue linting children
end
def visit_class(klass)
check_de... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/space_after_property_colon.rb | lib/scss_lint/linter/space_after_property_colon.rb | module SCSSLint
# Checks for spaces following the colon that separates a property's name from
# its value.
class Linter::SpaceAfterPropertyColon < Linter
include LinterRegistry
def visit_rule(node)
if config['style'] == 'aligned'
check_properties_alignment(node)
end
yield # Con... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/empty_rule.rb | lib/scss_lint/linter/empty_rule.rb | module SCSSLint
# Checks for rules with no content.
class Linter::EmptyRule < Linter
include LinterRegistry
def visit_rule(node)
add_lint(node, 'Empty rule') if node.children.empty?
yield # Continue linting children
end
end
end
| ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/property_spelling.rb | lib/scss_lint/linter/property_spelling.rb | module SCSSLint
# Checks for misspelled properties.
class Linter::PropertySpelling < Linter
include LinterRegistry
KNOWN_PROPERTIES = File.open(File.join(SCSS_LINT_DATA, 'properties.txt'))
.read
.split
.to_set
def visit_r... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/import_path.rb | lib/scss_lint/linter/import_path.rb | module SCSSLint
# Checks formatting of the basenames of @imported partials
class Linter::ImportPath < Linter
include LinterRegistry
def visit_import(node)
# Ignore CSS imports
return if File.extname(node.imported_filename) == '.css'
basename = File.basename(node.imported_filename)
r... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/private_naming_convention.rb | lib/scss_lint/linter/private_naming_convention.rb | module SCSSLint
# Verifies that variables, functions, and mixins that follow the private
# naming convention are defined and used within the same file.
class Linter::PrivateNamingConvention < Linter # rubocop:disable Metrics/ClassLength
include LinterRegistry
DEFINITIONS = {
Sass::Tree::FunctionNod... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/space_after_variable_colon.rb | lib/scss_lint/linter/space_after_variable_colon.rb | module SCSSLint
# Checks for spaces following the colon that separates a variable's name from
# its value.
class Linter::SpaceAfterVariableColon < Linter
include LinterRegistry
def visit_variable(node)
whitespace = whitespace_after_colon(node)
case config['style']
when 'no_space'
... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/space_after_property_name.rb | lib/scss_lint/linter/space_after_property_name.rb | module SCSSLint
# Checks for spaces following the name of a property and before the colon
# separating the property's name from its value.
class Linter::SpaceAfterPropertyName < Linter
include LinterRegistry
def visit_prop(node)
offset = property_name_colon_offset(node)
return unless characte... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/space_around_operator.rb | lib/scss_lint/linter/space_around_operator.rb | # frozen_string_literal: true
module SCSSLint
# Checks for space around operators on values.
class Linter::SpaceAroundOperator < Linter
include LinterRegistry
def visit_script_operation(node)
operation_sources = OperationSources.new(node, self)
operation_sources.adjust_sources
# When an... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/selector_depth.rb | lib/scss_lint/linter/selector_depth.rb | module SCSSLint
# Checks for selectors with large depths of applicability.
class Linter::SelectorDepth < Linter
include LinterRegistry
def visit_root(_node)
@max_depth = config['max_depth']
@depth = 0
yield # Continue
end
def visit_rule(node)
old_depth = @depth
@depth... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/hex_validation.rb | lib/scss_lint/linter/hex_validation.rb | module SCSSLint
# Checks for invalid hexadecimal colors.
class Linter::HexValidation < Linter
include LinterRegistry
def visit_script_string(node)
return unless node.type == :identifier
node.value.scan(/(?:\W|^)(#\h+)(?:\W|$)/) do |match|
check_hex(match.first, node)
end
end
... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/duplicate_property.rb | lib/scss_lint/linter/duplicate_property.rb | module SCSSLint
# Checks for a property declared twice in a rule set.
class Linter::DuplicateProperty < Linter
include LinterRegistry
def visit_root(_node)
@ignore_consecutive = config['ignore_consecutive']
yield
end
def check_properties(node)
static_properties(node).each_with_ob... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/else_placement.rb | lib/scss_lint/linter/else_placement.rb | module SCSSLint
# Checks where `@else` and `@else if` directives are placed with respect to
# the previous curly brace.
class Linter::ElsePlacement < Linter
include LinterRegistry
def visit_if(node)
visit_else(node, node.else) if node.else
yield # Lint nested @if statements
visit(node.e... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/important_rule.rb | lib/scss_lint/linter/important_rule.rb | module SCSSLint
# Reports the use of !important in properties.
class Linter::ImportantRule < Linter
include LinterRegistry
def visit_prop(node)
return unless source_from_range(node.source_range).include?('!important')
add_lint(node, '!important should not be used')
end
end
end
| ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/linter/compass/property_with_mixin.rb | lib/scss_lint/linter/compass/property_with_mixin.rb | module SCSSLint
# Checks for uses of properties where a Compass mixin would be preferred.
class Linter::Compass::PropertyWithMixin < Linter::Compass
include LinterRegistry
def visit_prop(node)
check_for_properties_with_mixins(node)
check_for_inline_block(node)
end
private
# Set of p... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/plugins/linter_gem.rb | lib/scss_lint/plugins/linter_gem.rb | module SCSSLint
class Plugins
# Load linter plugin gems
class LinterGem
attr_reader :config
def initialize(name)
@name = name
end
def load
require @name
@config = plugin_config
self
rescue LoadError
raise SCSSLint::Exceptions::PluginGemLo... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/plugins/linter_dir.rb | lib/scss_lint/plugins/linter_dir.rb | module SCSSLint
class Plugins
# Load ruby files from linter plugin directories.
class LinterDir
attr_reader :config
def initialize(dir)
@dir = dir
end
def load
ruby_files.each { |file| require file }
@config = plugin_config
self
end
private
... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/sass/script.rb | lib/scss_lint/sass/script.rb | # Ignore documentation lints as these aren't original implementations.
# rubocop:disable Style/Documentation
module Sass::Script
# Since the Sass library is already loaded at this point.
# Define the `node_name` and `visit_method` class methods for each Sass Script
# parse tree node type so that our custom visit... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/sass/tree.rb | lib/scss_lint/sass/tree.rb | # Contains extensions of Sass::Tree::Nodes to add support for traversing the
# Sass::Script::Node parse trees contained within the nodes. This probably
# breaks the Sass compiler, but since we're only doing lints this is fine for
# now.
module Sass::Tree
# Ignore documentation lints as these aren't original implement... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/reporter/stats_reporter.rb | lib/scss_lint/reporter/stats_reporter.rb | module SCSSLint
# Reports a single line per lint.
class Reporter::StatsReporter < Reporter
def report_lints # rubocop:disable Metrics/AbcSize
return unless lints.any?
stats = organize_stats
total_lints = lints.length
linter_name_length =
stats.inject('') { |memo, stat| memo.leng... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/reporter/default_reporter.rb | lib/scss_lint/reporter/default_reporter.rb | module SCSSLint
# Reports a single line per lint.
class Reporter::DefaultReporter < Reporter
def report_lints
return unless lints.any?
"#{lints.map { |lint| "#{location(lint)} #{type(lint)} #{message(lint)}" }.join("\n")}\n"
end
private
def location(lint)
[
log.cyan(lint.f... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/reporter/config_reporter.rb | lib/scss_lint/reporter/config_reporter.rb | module SCSSLint
# Returns a YAML configuration where all linters are disabled which
# caused a lint.
class Reporter::ConfigReporter < Reporter
def report_lints
{ 'linters' => disabled_linters }.to_yaml unless lints.empty?
end
private
def disabled_linters
linters.each_with_object({}) do... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/reporter/clean_files_reporter.rb | lib/scss_lint/reporter/clean_files_reporter.rb | module SCSSLint
# Reports a single line for each clean file (having zero lints).
class Reporter::CleanFilesReporter < Reporter
def report_lints
dirty_files = lints.map(&:filename).uniq
clean_files = files.map { |e| e['path'] } - dirty_files
"#{clean_files.sort.join("\n")}\n" if clean_files.any... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/reporter/json_reporter.rb | lib/scss_lint/reporter/json_reporter.rb | require 'json'
module SCSSLint
# Reports lints in a JSON format.
class Reporter::JSONReporter < Reporter
def report_lints
output = {}
lints.group_by(&:filename).each do |filename, file_lints|
output[filename] = file_lints.map do |lint|
issue_hash(lint)
end
end
... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/reporter/tap_reporter.rb | lib/scss_lint/reporter/tap_reporter.rb | module SCSSLint
# Reports in TAP format.
# http://testanything.org/
class Reporter::TAPReporter < Reporter
TAP_VERSION = 'TAP version 13'.freeze
def report_lints
output = [TAP_VERSION, format_plan(files, lints)]
return format_output(output) unless files.any?
output.concat(format_files(... | ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
sds/scss-lint | https://github.com/sds/scss-lint/blob/9099df2a76c24a36fd53a258505ce4ce10dbf3aa/lib/scss_lint/reporter/files_reporter.rb | lib/scss_lint/reporter/files_reporter.rb | module SCSSLint
# Reports a single line per file.
class Reporter::FilesReporter < Reporter
def report_lints
"#{lints.map(&:filename).uniq.join("\n")}\n" if lints.any?
end
end
end
| ruby | MIT | 9099df2a76c24a36fd53a258505ce4ce10dbf3aa | 2026-01-04T15:49:38.837314Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/lograge_spec.rb | spec/lograge_spec.rb | # frozen_string_literal: true
require 'active_support'
require 'active_support/notifications'
require 'active_support/core_ext/string'
require 'active_support/deprecation'
require 'active_support/log_subscriber'
require 'action_controller'
require 'action_controller/log_subscriber'
require 'action_view/log_subscriber'... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/silent_logger_spec.rb | spec/silent_logger_spec.rb | # frozen_string_literal: true
require 'logger'
describe Lograge::SilentLogger do
let(:base_logger) { Logger.new($stdout) }
subject(:silent_logger) { described_class.new(base_logger) }
it "doesn't call base logger on either log method" do
%i[debug info warn error fatal unknown].each do |method_name|
e... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'simplecov'
SimpleCov.start
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# Require this file using `require "spec_helper.rb"` to ensure that it is only
# loaded once.
#
# ... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/log_subscribers/action_controller_spec.rb | spec/log_subscribers/action_controller_spec.rb | # frozen_string_literal: true
require 'lograge/log_subscribers/action_controller'
require 'active_support'
require 'active_support/notifications'
require 'active_support/core_ext/string'
require 'logger'
require 'active_record'
require 'rails'
describe Lograge::LogSubscribers::ActionController do
let(:log_output) {... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/log_subscribers/action_cable_spec.rb | spec/log_subscribers/action_cable_spec.rb | # frozen_string_literal: true
require 'lograge/log_subscribers/action_controller'
require 'active_support'
require 'active_support/notifications'
require 'active_support/core_ext/string'
require 'logger'
require 'active_record'
require 'rails'
describe Lograge::LogSubscribers::ActionCable do
let(:log_output) { Stri... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/support/examples.rb | spec/support/examples.rb | # frozen_string_literal: true
shared_examples_for 'a key value formatter' do
let(:payload) do
{
custom: 'data',
status: 200,
method: 'GET',
path: '/',
controller: 'welcome',
action: 'index'
}
end
subject { described_class.new.call(payload) }
it "includes the 'metho... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/formatters/ltsv_spec.rb | spec/formatters/ltsv_spec.rb | # frozen_string_literal: true
describe Lograge::Formatters::LTSV do
let(:payload) do
{
custom: 'data',
status: 200,
method: 'GET',
path: '/',
controller: 'welcome',
action: 'index',
will_escaped: '\t'
}
end
subject { described_class.new.call(payload) }
it "in... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/formatters/cee_spec.rb | spec/formatters/cee_spec.rb | # frozen_string_literal: true
describe Lograge::Formatters::Cee do
it 'prepends the output with @cee' do
expect(subject.call({})).to match(/^@cee/)
end
it 'serializes custom attributes' do
expect(subject.call(custom: 'data')).to match('{"custom":"data"}')
end
end
| ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/formatters/graylog2_spec.rb | spec/formatters/graylog2_spec.rb | # frozen_string_literal: true
describe Lograge::Formatters::Graylog2 do
let(:payload) do
{
custom: 'data',
status: 200,
method: 'GET',
path: '/',
controller: 'welcome',
action: 'index'
}
end
subject { described_class.new.call(payload) }
it "provides the ':_custom' ... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/formatters/key_value_spec.rb | spec/formatters/key_value_spec.rb | # frozen_string_literal: true
describe Lograge::Formatters::KeyValue do
let(:payload) do
{
custom: 'data',
status: 200,
method: 'GET',
path: '/',
controller: 'welcome',
action: 'index'
}
end
subject { described_class.new.call(payload) }
it "includes the 'controller... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/formatters/lines_spec.rb | spec/formatters/lines_spec.rb | # frozen_string_literal: true
describe Lograge::Formatters::Lines do
it 'can serialize custom data' do
expect(subject.call(custom: 'data')).to eq('custom=data')
end
end
| ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/formatters/logstash_spec.rb | spec/formatters/logstash_spec.rb | # frozen_string_literal: true
describe Lograge::Formatters::Logstash do
let(:payload) do
{
custom: 'data',
status: 200,
method: 'GET',
path: '/',
controller: 'welcome',
action: 'index'
}
end
subject { described_class.new.call(payload) }
it "includes the 'custom' ke... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/formatters/json_spec.rb | spec/formatters/json_spec.rb | # frozen_string_literal: true
describe Lograge::Formatters::Json do
let(:deserialized_output) { JSON.parse(subject.call(custom: 'data')) }
it 'serializes custom attributes' do
expect(deserialized_output).to eq('custom' => 'data')
end
end
| ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/formatters/l2met_spec.rb | spec/formatters/l2met_spec.rb | # frozen_string_literal: true
describe Lograge::Formatters::L2met do
let(:payload) do
{
custom: 'data',
status: 200,
method: 'GET',
path: '/',
controller: 'admin/welcome',
action: 'index',
db: 20.00,
view: 10.00,
duration: 30.00,
cache: 40.00
}
en... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/formatters/raw_spec.rb | spec/formatters/raw_spec.rb | # frozen_string_literal: true
describe Lograge::Formatters::Raw do
it 'serializes custom attributes' do
expect(subject.call(custom: 'data')).to eq(custom: 'data')
end
end
| ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/formatters/key_value_deep_spec.rb | spec/formatters/key_value_deep_spec.rb | # frozen_string_literal: true
describe Lograge::Formatters::KeyValueDeep do
let(:payload) do
{
custom: 'data',
status: 200,
method: 'GET',
path: '/',
controller: 'welcome',
action: 'index',
params: {
object: {
key: 'value',
key_array: [1, '2',... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/spec/formatters/helpers/method_and_path_spec.rb | spec/formatters/helpers/method_and_path_spec.rb | # frozen_string_literal: true
describe Lograge::Formatters::Helpers::MethodAndPath do
describe '#method_and_path_string' do
let(:instance) do
Object.new.extend(described_class)
end
let(:method_and_path_string) { instance.method_and_path_string(data) }
context "when both 'method' and 'path' fi... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge.rb | lib/lograge.rb | # frozen_string_literal: true
require 'lograge/version'
require 'lograge/formatters/helpers/method_and_path'
require 'lograge/formatters/cee'
require 'lograge/formatters/json'
require 'lograge/formatters/graylog2'
require 'lograge/formatters/key_value'
require 'lograge/formatters/key_value_deep'
require 'lograge/forma... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/silent_logger.rb | lib/lograge/silent_logger.rb | # frozen_string_literal: true
require 'delegate'
module Lograge
class SilentLogger < SimpleDelegator
%i[debug info warn error fatal unknown].each do |method_name|
# rubocop:disable Lint/EmptyBlock
define_method(method_name) { |*_args| }
# rubocop:enable Lint/EmptyBlock
end
end
end
| ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/ordered_options.rb | lib/lograge/ordered_options.rb | # frozen_string_literal: true
require 'active_support'
require 'active_support/ordered_options'
module Lograge
class OrderedOptions < ActiveSupport::OrderedOptions
def custom_payload(&block)
self.custom_payload_method = block
end
end
end
| ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/version.rb | lib/lograge/version.rb | # frozen_string_literal: true
module Lograge
VERSION = '0.14.0'
end
| ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/railtie.rb | lib/lograge/railtie.rb | # frozen_string_literal: true
require 'rails/railtie'
require 'action_view/log_subscriber'
require 'action_controller/log_subscriber'
module Lograge
class Railtie < Rails::Railtie
config.lograge = Lograge::OrderedOptions.new
config.lograge.enabled = false
initializer :deprecator do |app|
app.depr... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/log_subscribers/action_cable.rb | lib/lograge/log_subscribers/action_cable.rb | # frozen_string_literal: true
module Lograge
module LogSubscribers
class ActionCable < Base
%i[perform_action subscribe unsubscribe connect disconnect].each do |method_name|
define_method(method_name) do |event|
process_main_event(event)
end
end
private
def ini... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/log_subscribers/base.rb | lib/lograge/log_subscribers/base.rb | # frozen_string_literal: true
require 'json'
require 'action_pack'
require 'active_support'
require 'active_support/core_ext/class/attribute'
require 'active_support/log_subscriber'
require 'request_store'
module Lograge
module LogSubscribers
class Base < ActiveSupport::LogSubscriber
def logger
Lo... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/log_subscribers/action_controller.rb | lib/lograge/log_subscribers/action_controller.rb | # frozen_string_literal: true
module Lograge
module LogSubscribers
class ActionController < Base
def process_action(event)
process_main_event(event)
end
def redirect_to(event)
RequestStore.store[:lograge_location] = event.payload[:location]
end
def unpermitted_para... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/formatters/logstash.rb | lib/lograge/formatters/logstash.rb | # frozen_string_literal: true
module Lograge
module Formatters
class Logstash
include Lograge::Formatters::Helpers::MethodAndPath
def call(data)
load_dependencies
event = LogStash::Event.new(data)
event['message'] = "[#{data[:status]}]#{method_and_path_string(data)}(#{data[:... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/formatters/lines.rb | lib/lograge/formatters/lines.rb | # frozen_string_literal: true
module Lograge
module Formatters
class Lines
def call(data)
load_dependencies
::Lines.dump(data)
end
def load_dependencies
require 'lines'
rescue LoadError
puts 'You need to install the lines gem to use this output.'
... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/formatters/graylog2.rb | lib/lograge/formatters/graylog2.rb | # frozen_string_literal: true
module Lograge
module Formatters
class Graylog2
include Lograge::Formatters::Helpers::MethodAndPath
def call(data)
# Add underscore to every key to follow GELF additional field syntax.
data.transform_keys { |k| underscore_prefix(k) }.merge(
sho... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/formatters/raw.rb | lib/lograge/formatters/raw.rb | # frozen_string_literal: true
module Lograge
module Formatters
class Raw
def call(data)
data
end
end
end
end
| ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/formatters/json.rb | lib/lograge/formatters/json.rb | # frozen_string_literal: true
require 'json'
module Lograge
module Formatters
class Json
def call(data)
::JSON.dump(data)
end
end
end
end
| ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/formatters/key_value.rb | lib/lograge/formatters/key_value.rb | # frozen_string_literal: true
module Lograge
module Formatters
class KeyValue
def call(data)
fields_to_display(data)
.map { |key| format(key, data[key]) }
.join(' ')
end
protected
def fields_to_display(data)
data.keys
end
def format(key, ... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/formatters/l2met.rb | lib/lograge/formatters/l2met.rb | # frozen_string_literal: true
require 'lograge/formatters/key_value'
module Lograge
module Formatters
class L2met < KeyValue
L2MET_FIELDS = %i[
method
path
format
source
status
error
duration
view
db
location
].freeze
... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/formatters/cee.rb | lib/lograge/formatters/cee.rb | # frozen_string_literal: true
module Lograge
module Formatters
class Cee
def call(data)
"@cee: #{JSON.dump(data)}"
end
end
end
end
| ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/formatters/ltsv.rb | lib/lograge/formatters/ltsv.rb | # frozen_string_literal: true
module Lograge
module Formatters
class LTSV
def call(data)
fields = fields_to_display(data)
event = fields.map { |key| format(key, data[key]) }
event.join("\t")
end
def fields_to_display(data)
data.keys
end
def format(... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/formatters/key_value_deep.rb | lib/lograge/formatters/key_value_deep.rb | # frozen_string_literal: true
module Lograge
module Formatters
class KeyValueDeep < KeyValue
def call(data)
super(flatten_keys(data))
end
protected
def flatten_keys(data, prefix = '')
return flatten_object(data, prefix) if [Hash, Array].include? data.class
data
... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/formatters/helpers/method_and_path.rb | lib/lograge/formatters/helpers/method_and_path.rb | # frozen_string_literal: true
module Lograge
module Formatters
module Helpers
module MethodAndPath
def method_and_path_string(data)
method_and_path = [data[:method], data[:path]].compact
method_and_path.any?(&:present?) ? " #{method_and_path.join(' ')} " : ' '
end
... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/rails_ext/rack/logger.rb | lib/lograge/rails_ext/rack/logger.rb | # frozen_string_literal: true
require 'active_support'
require 'active_support/concern'
require 'rails/rack/logger'
module Rails
module Rack
# Overwrites defaults of Rails::Rack::Logger that cause
# unnecessary logging.
# This effectively removes the log lines from the log
# that say:
# Started ... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/rails_ext/action_cable/connection/base.rb | lib/lograge/rails_ext/action_cable/connection/base.rb | # frozen_string_literal: true
module Lograge
module ActionCable
module ConnectionInstrumentation
def handle_open
ActiveSupport::Notifications.instrument('connect.action_cable', notification_payload('connect')) { super }
end
def handle_close
ActiveSupport::Notifications.instrume... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/rails_ext/action_cable/server/base.rb | lib/lograge/rails_ext/action_cable/server/base.rb | # frozen_string_literal: true
module ActionCable
module Server
class Base
mattr_accessor :logger
self.logger = Lograge::SilentLogger.new(config.logger)
end
end
end
| ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
roidrage/lograge | https://github.com/roidrage/lograge/blob/27066cd75d449cb91ed79b18c4271d62a76c9839/lib/lograge/rails_ext/action_cable/channel/base.rb | lib/lograge/rails_ext/action_cable/channel/base.rb | # frozen_string_literal: true
module Lograge
module ActionCable
module ChannelInstrumentation
def subscribe_to_channel
ActiveSupport::Notifications.instrument('subscribe.action_cable', notification_payload('subscribe')) { super }
end
def unsubscribe_from_channel
ActiveSupport::... | ruby | MIT | 27066cd75d449cb91ed79b18c4271d62a76c9839 | 2026-01-04T15:50:09.341177Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/init.rb | init.rb | require 'wicked_pdf'
require 'wicked_pdf_tempfile'
| ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/test/test_helper.rb | test/test_helper.rb | # Configure Rails Environment
ENV['RAILS_ENV'] = 'test'
require File.expand_path('../dummy/config/environment.rb', __FILE__)
require 'test/unit'
require 'mocha'
require 'rails/test_help'
require 'mocha/test_unit'
require 'webmock/minitest'
require 'wicked_pdf'
Rails.backtrace_cleaner.remove_silencers!
WickedPdf.sil... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/test/unit/wicked_pdf_binary_test.rb | test/unit/wicked_pdf_binary_test.rb | require 'test_helper'
class WickedPdfBinaryTest < ActiveSupport::TestCase
test 'should extract old wkhtmltopdf version' do
version_info_sample = "Name:\n wkhtmltopdf 0.9.9\n\nLicense:\n Copyright (C) 2008,2009 Wkhtmltopdf Authors.\n\n\n\n License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/test/unit/wicked_pdf_test.rb | test/unit/wicked_pdf_test.rb | require 'test_helper'
WickedPdf.config = { :exe_path => ENV['WKHTMLTOPDF_BIN'] || '/usr/local/bin/wkhtmltopdf' }
HTML_DOCUMENT = '<html><body>Hello World</body></html>'.freeze
class WickedPdfTest < ActiveSupport::TestCase
def setup
@wp = WickedPdf.new
end
test 'should update config through .configure class ... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/test/unit/wkhtmltopdf_location_test.rb | test/unit/wkhtmltopdf_location_test.rb | class WkhtmltopdfLocationTest < ActiveSupport::TestCase
setup do
@saved_config = WickedPdf.config
WickedPdf.config = {}
end
teardown do
WickedPdf.config = @saved_config
end
test 'should correctly locate wkhtmltopdf without bundler' do
bundler_module = Bundler
Object.send(:remove_const, :... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/test/unit/wicked_pdf_option_parser_test.rb | test/unit/wicked_pdf_option_parser_test.rb | require 'test_helper'
class WickedPdfOptionParserTest < ActiveSupport::TestCase
test 'should parse header and footer options' do
%i[header footer].each do |hf|
%i[center font_name left right].each do |o|
assert_equal "--#{hf}-#{o.to_s.tr('_', '-')} header_footer",
parse_options... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/test/functional/wicked_pdf_helper_test.rb | test/functional/wicked_pdf_helper_test.rb | require 'test_helper'
require 'action_view/test_case'
class WickedPdfHelperTest < ActionView::TestCase
include WickedPdf::WickedPdfHelper
test 'wicked_pdf_stylesheet_link_tag should inline the stylesheets passed in' do
assert_equal "<style type='text/css'>/* Wicked styles */\n</style>",
wicke... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/test/functional/wicked_pdf_helper_assets_test.rb | test/functional/wicked_pdf_helper_assets_test.rb | require 'test_helper'
require 'action_view/test_case'
class WickedPdfHelperAssetsTest < ActionView::TestCase
include WickedPdf::WickedPdfHelper::Assets
setup do
@saved_config = WickedPdf.config
WickedPdf.config = {}
end
teardown do
WickedPdf.config = @saved_config
# @see freerange/mocha#331
... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/test/functional/pdf_helper_test.rb | test/functional/pdf_helper_test.rb | require 'test_helper'
module ActionController
class Base
def render_to_string(opts = {})
opts.to_s
end
def self.alias_method_chain(_target, _feature); end
end
end
module ActionControllerMock
class Base
def render(_)
[:base]
end
def render_to_string; end
def self.after_... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/generators/wicked_pdf/wicked_pdf_generator.rb | generators/wicked_pdf/wicked_pdf_generator.rb | class WickedPdfGenerator < Rails::Generator::Base
def manifest
record do |m|
m.file 'wicked_pdf.rb', 'config/initializers/wicked_pdf.rb'
end
end
end
| ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/generators/wicked_pdf/templates/wicked_pdf.rb | generators/wicked_pdf/templates/wicked_pdf.rb | # WickedPDF Global Configuration
#
# Use this to set up shared configuration options for your entire application.
# Any of the configuration options shown here can also be applied to single
# models by passing arguments to the `render :pdf` call.
#
# To learn more, check out the README:
#
# https://github.com/mileszs/w... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/lib/wicked_pdf.rb | lib/wicked_pdf.rb | # frozen_string_literal: true
# wkhtml2pdf Ruby interface
# http://wkhtmltopdf.org/
require 'logger'
require 'digest/md5'
require 'rbconfig'
require 'open3'
require 'ostruct'
require 'active_support/core_ext/module/attribute_accessors'
require 'active_support/core_ext/object/blank'
require 'wicked_pdf/version'
requ... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/lib/generators/wicked_pdf_generator.rb | lib/generators/wicked_pdf_generator.rb | # Rails generator invoked with 'rails generate wicked_pdf'
class WickedPdfGenerator < Rails::Generators::Base
source_root(File.expand_path(File.dirname(__FILE__) + '/../../generators/wicked_pdf/templates'))
def copy_initializer
copy_file 'wicked_pdf.rb', 'config/initializers/wicked_pdf.rb'
end
end
| ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/lib/wicked_pdf/version.rb | lib/wicked_pdf/version.rb | # frozen_string_literal: true
class WickedPdf
VERSION = '2.8.1'
end
| ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/lib/wicked_pdf/binary.rb | lib/wicked_pdf/binary.rb | # frozen_string_literal: true
class WickedPdf
class Binary
EXE_NAME = 'wkhtmltopdf'
attr_reader :path, :default_version
def initialize(binary_path, default_version = WickedPdf::DEFAULT_BINARY_VERSION)
@path = binary_path || find_binary_path
@default_version = default_version
raise "L... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/lib/wicked_pdf/option_parser.rb | lib/wicked_pdf/option_parser.rb | # frozen_string_literal: true
class WickedPdf
class OptionParser
BINARY_VERSION_WITHOUT_DASHES = Gem::Version.new('0.12.0')
attr_reader :binary_version, :hf_tempfiles
def initialize(binary_version = WickedPdf::DEFAULT_BINARY_VERSION)
@binary_version = binary_version
end
def parse(options... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/lib/wicked_pdf/pdf_helper.rb | lib/wicked_pdf/pdf_helper.rb | # frozen_string_literal: true
class WickedPdf
module PdfHelper
def self.prepended(base)
# Protect from trying to augment modules that appear
# as the result of adding other gems.
return if base != ActionController::Base
base.class_eval do
after_action :clean_temp_files
end
... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/lib/wicked_pdf/middleware.rb | lib/wicked_pdf/middleware.rb | # frozen_string_literal: true
class WickedPdf
class Middleware
def initialize(app, options = {}, conditions = {})
@app = app
@options = (WickedPdf.config || {}).merge(options)
@conditions = conditions
end
def call(env)
@request = Rack::Request.new(env)
@render_pdf = false
... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/lib/wicked_pdf/tempfile.rb | lib/wicked_pdf/tempfile.rb | # frozen_string_literal: true
require 'tempfile'
require 'stringio'
class WickedPdf
class Tempfile < ::Tempfile
def initialize(filename, temp_dir = nil)
temp_dir ||= Dir.tmpdir
extension = File.extname(filename)
basename = File.basename(filename, extension)
super([basename, extension], t... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/lib/wicked_pdf/railtie.rb | lib/wicked_pdf/railtie.rb | # frozen_string_literal: true
require 'wicked_pdf/pdf_helper'
require 'wicked_pdf/wicked_pdf_helper'
require 'wicked_pdf/wicked_pdf_helper/assets'
class WickedPdf
if defined?(Rails.env)
class WickedRailtie < Rails::Railtie
initializer 'wicked_pdf.register', :after => 'remotipart.controller_helper' do |_ap... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/lib/wicked_pdf/wicked_pdf_helper.rb | lib/wicked_pdf/wicked_pdf_helper.rb | # frozen_string_literal: true
class WickedPdf
module WickedPdfHelper
def self.root_path
String === Rails.root ? Pathname.new(Rails.root) : Rails.root
end
def self.add_extension(filename, extension)
filename.to_s.split('.').include?(extension) ? filename : "#{filename}.#{extension}"
end
... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/lib/wicked_pdf/progress.rb | lib/wicked_pdf/progress.rb | # frozen_string_literal: true
class WickedPdf
module Progress
require 'pty' if RbConfig::CONFIG['target_os'] !~ /mswin|mingw/ && RUBY_ENGINE != 'truffleruby' # no support for windows and truffleruby
require 'English'
def track_progress?(options)
options[:progress] && !(on_windows? || RUBY_ENGINE =... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
mileszs/wicked_pdf | https://github.com/mileszs/wicked_pdf/blob/bce498de547cdf00d037fdbec29fae844d69ee8e/lib/wicked_pdf/wicked_pdf_helper/assets.rb | lib/wicked_pdf/wicked_pdf_helper/assets.rb | # frozen_string_literal: true
require 'net/http'
require 'delegate'
require 'stringio'
class WickedPdf
module WickedPdfHelper
module Assets
ASSET_URL_REGEX = /url\(['"]?([^'"]+?)['"]?\)/
class MissingAsset < StandardError; end
class MissingLocalAsset < MissingAsset
attr_reader :path
... | ruby | MIT | bce498de547cdf00d037fdbec29fae844d69ee8e | 2026-01-04T15:50:04.858219Z | false |
feedbin/feedbin | https://github.com/feedbin/feedbin/blob/02911157804301424ec3b1a17e1a9583c09b9e9b/app/jobs/feed_fixer_scheduler.rb | app/jobs/feed_fixer_scheduler.rb | class FeedFixerScheduler
include Sidekiq::Worker
include SidekiqHelper
def perform
FeedFixer.new.build
end
end
| ruby | MIT | 02911157804301424ec3b1a17e1a9583c09b9e9b | 2026-01-04T15:49:01.344805Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.