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 |
|---|---|---|---|---|---|---|---|---|
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/recipes/install_casks.rb | recipes/install_casks.rb | #
# Cookbook:: homebrew
# Recipe:: install_casks
#
# Copyright:: 2014-2019, Chef Software, Inc <legal@chef.io>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/li... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/recipes/cask.rb | recipes/cask.rb | #
# Cookbook:: homebrew
# Recipes:: cask
#
# Copyright:: 2014-2019, Chef Software, Inc <legal@chef.io>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/L... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/attributes/default.rb | attributes/default.rb | #
# Author:: Joshua Timberman (<jtimberman@chef.io>)
# Author:: Graeme Mathieson (<mathie@woss.name>)
# Cookbook:: homebrew
# Attributes:: default
#
# Copyright:: 2011-2019, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/spec/spec_helper.rb | spec/spec_helper.rb | require 'chefspec'
require 'chefspec/policyfile'
require_relative '../libraries/helpers'
RSpec.configure do |config|
config.color = true # Use color in STDOUT
config.formatter = :documentation # Use the specified formatter
config.log_level = :error # Avoid deprecation notice SPAM
config.... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/spec/unit/libraries/homebrew_helpers_spec.rb | spec/unit/libraries/homebrew_helpers_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'chef/mixin/shell_out'
RSpec.describe Homebrew do
let(:homebrew) { HomebrewWrapper.new }
describe '#install_path' do
it 'returns /opt/homebrew for ARM-based systems' do
allow(homebrew).to receive(:shell_out).with('sysctl -n hw.optional.arm64')... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/libraries/helpers.rb | libraries/helpers.rb | #
# Author:: Joshua Timberman (<jtimberman@chef.io>)
# Author:: Graeme Mathieson (<mathie@woss.name>)
# Cookbook:: homebrew
# Library:: helpers
#
# Copyright:: 2011-2019, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lic... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/resources/tap.rb | resources/tap.rb | #
# Author:: Joshua Timberman (<jtimberman@chef.io>)
# Author:: Graeme Mathieson (<mathie@woss.name>)
# Cookbook:: homebrew
# Resources:: tap
#
# Copyright:: 2011-2019, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/resources/cask.rb | resources/cask.rb | #
# Author:: Joshua Timberman (<jtimberman@chef.io>)
# Author:: Graeme Mathieson (<mathie@woss.name>)
# Cookbook:: homebrew
# Resources:: cask
#
# Copyright:: 2011-2019, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/app/helpers/flat_ui/rails/icon_helper.rb | app/helpers/flat_ui/rails/icon_helper.rb | # Rails view helpers for Flat-UI glyphs
# Based on https://github.com/bokmann/font-awesome-rails/blob/master/app/helpers/font_awesome/rails/icon_helper.rb
module FlatUI
module Rails
module IconHelper
# Creates an icon tag given an icon name and possible icon
# modifiers.
#
# Examples
... | ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/templates/project/manifest.rb | templates/project/manifest.rb | require 'bootstrap-sass'
description 'Flat UI for SASS'
assets = "../../vendor/assets"
flatui_dir = File.exist?("#{assets}/stylesheets/flat-ui-pro") ? 'flat-ui-pro' : 'flat-ui'
# Imports for Flat UI and bootstrap
stylesheet 'styles.scss'
# SCSS:
flatui_stylesheets = "#{assets}/stylesheets/#{flatui_dir}"
stylesheet... | ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/lib/flat-ui-sass.rb | lib/flat-ui-sass.rb | # Based on bootstrap-sass.rb
# https://github.com/twbs/bootstrap-sass/blob/master/lib/bootstrap-sass.rb
require "bootstrap-sass"
require "flat-ui-sass/version"
module FlatUI
class << self
def load!
require 'flat-ui-sass/sass_functions'
register_compass_extension if compass?
if rails?
... | ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/lib/tasks/converter.rb | lib/tasks/converter.rb | # encoding: utf-8
#
# Based on the conversion script used for bootstrap-sass
# https://github.com/twbs/bootstrap-sass/blob/master/tasks/converter.rb
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this work except in compliance with the License.
# You may obtain a copy of the Licen... | ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/lib/tasks/converter/flat_ui_js_conversion.rb | lib/tasks/converter/flat_ui_js_conversion.rb | class Converter
module FlatUIJsConversion
def process_flat_ui_javascript_assets!
log_status 'Processing javascripts...'
save_to = @dest_path[:js]
read_files('js', flat_ui_js_files).each do |name, file|
save_file("#{save_to}/#{name}", file)
end
log_processed "#{flat_ui_js_file... | ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/lib/tasks/converter/logger.rb | lib/tasks/converter/logger.rb | class Converter
class Logger
def initialize(log_level)
@log_level = log_level || 3
end
def log_status(status)
puts bold status if log_level?(:status)
end
def log_file_info(s)
puts " #{magenta s}" if log_level?(:all)
end
def log_transform(*args, from: caller[1][/`.*'... | ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/lib/tasks/converter/flat_ui_fonts_conversion.rb | lib/tasks/converter/flat_ui_fonts_conversion.rb | # encoding: UTF-8
class Converter
module FlatUIFontsConversion
def process_flat_ui_font_assets!
log_status 'Processing fonts...'
save_to = @dest_path[:fonts]
flat_ui_font_files.each do |file|
FileUtils.cp "#{@src_path}/fonts/#{file}", "#{save_to}/#{file}"
end
end
def flat... | ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/lib/tasks/converter/flat_ui_images_conversion.rb | lib/tasks/converter/flat_ui_images_conversion.rb | class Converter
module FlatUIImageConversion
def process_flat_ui_image_assets!
log_status 'Processing images...'
save_to = @dest_path[:images]
flat_ui_image_files.each do |file|
new_file = "#{save_to}/#{file}"
FileUtils.mkdir_p(File.dirname(new_file))
FileUtils.cp "#{@src... | ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/lib/tasks/converter/filesystem.rb | lib/tasks/converter/filesystem.rb | class Converter
module FileSystem
def read_files(path, files)
contents = {}
full_path = File.join(@src_path, path)
if File.directory?(full_path)
files.each do |file|
contents[file] = File.read(File.join(full_path, file), mode: 'rb') || ''
end
contents
en... | ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/lib/tasks/converter/flat_ui_less_conversion.rb | lib/tasks/converter/flat_ui_less_conversion.rb | class Converter
module FlatUILessConversion
include Converter::LessConversion
# Mixins that are added by FlatUI
FLAT_UI_MIXINS = %w{placeholder-height mask background-clip dropdown-arrow form-controls-corners-reset
label-variant navbar-vertical-align social-button-variant}
# M... | ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/lib/flat-ui-sass/version.rb | lib/flat-ui-sass/version.rb | module FlatUI
VERSION = '2.1.3'
PRO_VERSION = '1.2.5'
end
| ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/lib/flat-ui-sass/cli.rb | lib/flat-ui-sass/cli.rb | require 'optparse'
require 'tasks/converter'
require 'flat-ui-sass/version'
module FlatUI
class CLI
class << self
def start(*args)
options = parse_options!(*args)
Converter.new(options[:type], options[:input], options).process_flat_ui!
end
private
def parse_options!(*arg... | ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/lib/flat-ui-sass/sass_functions.rb | lib/flat-ui-sass/sass_functions.rb | # Based on bootstrap-sass
# https://github.com/twbs/bootstrap-sass/blob/master/lib/bootstrap-sass/sass_functions.rb
require 'sass'
module Sass::Script::Functions
def flat_ui_font_path(source)
flat_ui_asset_path source, :font
end
declare :flat_ui_font_path, [:source]
def flat_ui_image_path(source)
fla... | ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
wingrunr21/flat-ui-sass | https://github.com/wingrunr21/flat-ui-sass/blob/97b99ebd00a73c17b55cfb537722aede93cc7e49/lib/flat-ui-sass/engine.rb | lib/flat-ui-sass/engine.rb | module FlatUI
module Rails
class Engine < ::Rails::Engine
initializer "flat-ui-sass.assets.precompile" do |app|
if Dir.exist? File.join(::Rails.root, 'vendor', 'assets', 'fonts', 'flat-ui-pro')
app.config.assets.precompile << %r(flat-ui-pro/flat-ui-icons-regular\.(?:eot|svg|ttf|woff)$)
... | ruby | MIT | 97b99ebd00a73c17b55cfb537722aede93cc7e49 | 2026-01-04T17:33:15.646688Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/benchmarks/profile_view.rb | benchmarks/profile_view.rb | # frozen_string_literal: true
require "hotch"
require "pathname"
require "ostruct"
require "dry/view"
TEMPLATES_PATHS = Pathname(__FILE__).dirname.join("templates")
TEMPLATE_LOCALS = {
users: [
OpenStruct.new(name: "Jane", email: "Jane@example.com"),
OpenStruct.new(name: "Teresa", email: "teresa@example.co... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/benchmarks/benchmark_view.rb | benchmarks/benchmark_view.rb | # frozen_string_literal: true
require "pathname"
require "ostruct"
require "benchmark/ips"
require "dry/view"
require "action_view"
require "action_controller"
TEMPLATES_PATHS = Pathname(__FILE__).dirname.join("templates")
TEMPLATE_LOCALS = {
users: [
OpenStruct.new(name: "Jane", email: "Jane@example.com"),
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/bin/setup_helpers.rb | bin/setup_helpers.rb | # frozen_string_literal: true
require "open3"
module Setup
module_function
def execute(cmd)
puts "Running #{cmd}"
status, out, err = nil
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
_pid = wait_thr.pid
stdin.close
out = stdout.read
err = stderr.read
status = ... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require_relative "support/coverage"
begin
require "pry-byebug"
rescue LoadError; end
SPEC_ROOT = Pathname(__FILE__).dirname
FIXTURES_PATH = SPEC_ROOT.join("fixtures")
require "slim"
require "dry/view"
module Test
def self.remove_constants
constants.each(&method(:remove_const))
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/support/rspec_options.rb | spec/support/rspec_options.rb | RSpec.configure do |config|
# When no filter given, search and run focused tests
config.filter_run_when_matching :focus
# Disables rspec monkey patches (no reason for their existence tbh)
config.disable_monkey_patching!
# Run ruby in verbose mode
config.warnings = true
# Collect all failing expectation... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/support/warnings.rb | spec/support/warnings.rb | # frozen_string_literal: true
# this file is managed by dry-rb/devtools project
require "warning"
Warning.ignore(%r{rspec/core})
Warning.ignore(%r{rspec/mocks})
Warning.ignore(/codacy/)
Warning[:experimental] = false if Warning.respond_to?(:[])
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/support/coverage.rb | spec/support/coverage.rb | # frozen_string_literal: true
# this file is managed by dry-rb/devtools
if ENV["COVERAGE"] == "true"
require "simplecov"
require "simplecov-cobertura"
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
SimpleCov.start do
add_filter "/spec/"
enable_coverage :branch
end
end
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/view_spec.rb | spec/integration/view_spec.rb | # frozen_string_literal: true
RSpec.describe "dry-view" do
let(:view_class) do
Class.new(Dry::View) do
config.paths = SPEC_ROOT.join("fixtures/templates")
config.layout = "app"
config.template = "users"
config.default_format = :html
expose :users do
[
{name: "Jane... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/context_spec.rb | spec/integration/context_spec.rb | # frozen_string_literal: true
require "dry/view"
require "dry/view/context"
require "dry/view/part"
RSpec.describe "Context" do
it "Provides decorated attributes for use in templates and parts" do
module Test
class Assets
def [](path)
"hashed/path/to/#{path}"
end
end
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/scope_spec.rb | spec/integration/scope_spec.rb | # frozen_string_literal: true
require "dry/view/part"
require "dry/view/scope"
RSpec.describe "Scopes" do
let(:base_view) {
Class.new(Dry::View) do
config.paths = FIXTURES_PATH.join("integration/scopes")
end
}
specify "Custom scope for a view" do
module Test
class ControllerScope < Dry:... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/exposures_spec.rb | spec/integration/exposures_spec.rb | # frozen_string_literal: true
require "dry/view"
require "dry/view/context"
require "dry/view/part"
RSpec.describe "exposures" do
let(:context) {
Class.new(Dry::View::Context) do
def title
"dry-view rocks!"
end
def assets
-> input { "#{input}.jpg" }
end
end.new
}
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/part_builder_spec.rb | spec/integration/part_builder_spec.rb | # frozen_string_literal: true
RSpec.describe "part builder" do
before do
module Test
class Custom < Dry::View::Part
def to_s
"Custom part wrapping #{_value}"
end
end
CustomPart = Custom
class CustomArrayPart < Dry::View::Part
def each(&block)
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/part/decorated_attributes_spec.rb | spec/integration/part/decorated_attributes_spec.rb | # frozen_string_literal: true
require "dry/core/inflector"
require "dry/view/scope_builder"
RSpec.describe "Part / Decorated attributes" do
let(:article_class) {
Class.new do
attr_reader :title, :author, :comments
def initialize(title:, author:, comments:)
@title = title
@author = a... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/template_engines/slim_spec.rb | spec/integration/template_engines/slim_spec.rb | # frozen_string_literal: true
require "slim"
require "dry/view"
require "dry/view/context"
RSpec.describe "Template engines / slim" do
let(:base_view) {
Class.new(Dry::View) do
config.paths = FIXTURES_PATH.join("integration/template_engines/slim")
end
}
it "supports partials that yield" do
vi... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/template_engines/hamlit_spec.rb | spec/integration/template_engines/hamlit_spec.rb | # frozen_string_literal: true
require "dry/view"
require "dry/view/context"
RSpec.describe "Template engines / haml (using hamlit-block as default engine)" do
let(:base_view) {
Class.new(Dry::View) do
config.paths = FIXTURES_PATH.join("integration/template_engines/hamlit")
end
}
context "with ham... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/template_engines/erbse_spec.rb | spec/integration/template_engines/erbse_spec.rb | # frozen_string_literal: true
require "dry/view"
require "dry/view/context"
RSpec.describe "Template engines / erb (using erbse as default engine)" do
let(:base_view) {
Class.new(Dry::View) do
config.paths = FIXTURES_PATH.join("integration/template_engines/erbse")
end
}
context "with erbse availa... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/template_engines/erubi_spec.rb | spec/integration/template_engines/erubi_spec.rb | # frozen_string_literal: true
require "erubi"
require "erubi/capture_end"
require "tilt/erubi"
require "dry/view"
require "dry/view/context"
RSpec.describe "Template engines / erb (using erubi via an explict engine mapping)" do
let(:base_view) {
Class.new(Dry::View) do
config.paths = FIXTURES_PATH.join("... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/view/exposures_spec.rb | spec/integration/view/exposures_spec.rb | # frozen_string_literal: true
require "dry/view"
require "dry/view/context"
RSpec.describe "View / exposures" do
specify "exposures have access to context" do
view = Class.new(Dry::View) do
config.paths = SPEC_ROOT.join("fixtures/templates")
config.template = "greeting"
expose :greeting do |g... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/view/errors_spec.rb | spec/integration/view/errors_spec.rb | # frozen_string_literal: true
require "dry/view"
require "dry/view/context"
RSpec.describe "View / errors" do
specify "Raising an error when paths are not configured" do
view = Class.new(Dry::View) do
config.template = "hello"
end.new
expect { view.() }.to raise_error(Dry::View::UndefinedConfigEr... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/view/locals_spec.rb | spec/integration/view/locals_spec.rb | # frozen_string_literal: true
require "dry/view"
require "dry/view/part"
RSpec.describe "View / locals" do
specify "locals are decorated with parts by default" do
view = Class.new(Dry::View) do
config.paths = SPEC_ROOT.join("fixtures/templates")
config.template = "greeting"
expose :greeting
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/integration/testing/testing_parts_spec.rb | spec/integration/testing/testing_parts_spec.rb | # frozen_string_literal: true
RSpec.describe "Testing / parts" do
let(:part_class) {
Class.new(Dry::View::Part) do
end
}
specify "Parts can be unit tested without name or rendering (for testing methods that don't require them)" do
part_class = Class.new(Dry::View::Part) do
def breaking_news_ti... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/unit/rendered_spec.rb | spec/unit/rendered_spec.rb | # frozen_string_literal: true
require "dry/view/rendered"
RSpec.describe Dry::View::Rendered do
subject(:rendered) {
described_class.new(
output: "rendered template output",
locals: {
user: {name: "Jane"}
}
)
}
describe "#to_s" do
it "returns the rendered output" do
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/unit/path_spec.rb | spec/unit/path_spec.rb | # frozen-string-literal: true
require "dry/view/path"
RSpec.describe Dry::View::Path do
subject(:path) { Dry::View::Path.new(SPEC_ROOT.join("fixtures/templates")) }
it "returns path as String when cast as String" do
expect(path.to_s).to eq SPEC_ROOT.join("fixtures/templates").to_s
end
end
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/unit/view_spec.rb | spec/unit/view_spec.rb | # frozen_string_literal: true
require "tilt/erubi"
RSpec.describe Dry::View do
subject(:view) {
Class.new(Dry::View) do
config.paths = SPEC_ROOT.join("fixtures/templates")
config.layout = "app"
config.template = "user"
expose :user do
{name: "Jane"}
end
expose :head... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/unit/context_spec.rb | spec/unit/context_spec.rb | # frozen_string_literal: true
require "dry/view/context"
require "dry/view/part"
require "dry/view/part_builder"
require "dry/view/scope_builder"
RSpec.describe Dry::View::Context do
let(:context_class) {
Class.new(Dry::View::Context) do
attr_reader :assets, :routes
decorate :assets, :routes
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/unit/render_environment_spec.rb | spec/unit/render_environment_spec.rb | # frozen_string_literal: true
require "dry/view/render_environment"
require "dry/inflector"
require "dry/view/context"
require "dry/view/part_builder"
require "dry/view/scope_builder"
RSpec.describe Dry::View::RenderEnvironment do
subject(:render_env) { described_class.new(**options) }
let(:options) {
{
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/unit/renderer_spec.rb | spec/unit/renderer_spec.rb | # frozen_string_literal: true
require "dry/view/path"
require "dry/view/renderer"
RSpec.describe Dry::View::Renderer do
subject(:renderer) do
Dry::View::Renderer.new(
[Dry::View::Path.new(SPEC_ROOT.join("fixtures/templates"))],
format: "html",
default_encoding: "utf-8"
)
end
let(:scop... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/unit/scope_spec.rb | spec/unit/scope_spec.rb | # frozen_string_literal: true
require "dry/view/scope_builder"
RSpec.describe Dry::View::Scope do
let(:locals) { {} }
context "with a render environment" do
subject(:scope) {
described_class.new(
locals: locals,
render_env: render_env
)
}
let(:render_env) { spy(:render_en... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/unit/exposures_spec.rb | spec/unit/exposures_spec.rb | # frozen_string_literal: true
RSpec.describe Dry::View::Exposures do
subject(:exposures) { described_class.new }
describe "#exposures" do
it "is empty by defalut" do
expect(exposures.exposures).to be_empty
end
end
describe "#add" do
it "creates and adds an exposure" do
proc = -> **_in... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/unit/decorated_attributes_spec.rb | spec/unit/decorated_attributes_spec.rb | # frozen_string_literal: true
require "dry/view/decorated_attributes"
RSpec.describe Dry::View::DecoratedAttributes do
subject(:decoratable) {
Test::Decoratable = Struct.new(:attr_1, :attr_2, :_render_env) do
include Dry::View::DecoratedAttributes
decorate :attr_1, as: :my_value
decorate :att... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/unit/part_spec.rb | spec/unit/part_spec.rb | # frozen_string_literal: true
require "dry/view/scope_builder"
require "dry/view/render_environment_missing"
RSpec::Matchers.define :scope do |locals|
match do |actual|
locals == actual._locals
end
end
RSpec.describe Dry::View::Part do
let(:name) { :user }
let(:value) { double(:value) }
let(:render_env... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/unit/exposure_spec.rb | spec/unit/exposure_spec.rb | # frozen_string_literal: true
RSpec.describe Dry::View::Exposure do
subject(:exposure) { described_class.new(:hello, proc, object, **options) }
let(:proc) { -> _input { "hi" } }
let(:object) { nil }
let(:options) { {} }
describe "initialization and attributes" do
describe "#name" do
it "accepts a... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/spec/unit/part_builder_spec.rb | spec/unit/part_builder_spec.rb | # frozen_string_literal: true
require "dry/view/scope_builder"
RSpec.describe Dry::View::PartBuilder do
subject(:part_builder) { render_env.part_builder }
let(:render_env) {
Dry::View::RenderEnvironment.new(
renderer: Dry::View::Renderer.new([FIXTURES_PATH], format: :html),
inflector: Dry::Inflec... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/dry-system-sinatra/system/boot.rb | examples/dry-system-sinatra/system/boot.rb | # frozen_string_literal: true
require_relative "example_app/container"
container = ExampleApp::Container
container.finalize!
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/dry-system-sinatra/system/example_app/import.rb | examples/dry-system-sinatra/system/example_app/import.rb | # frozen_string_literal: true
require_relative "container"
module ExampleApp
Import = Container.injector
end
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/dry-system-sinatra/system/example_app/container.rb | examples/dry-system-sinatra/system/example_app/container.rb | # frozen_string_literal: true
require "dry/web/container"
require "dry/system/components"
module ExampleApp
class Container < Dry::Web::Container
configure do
config.name = :example_app
config.log_levels = %i[test development production].map { |e| [e, Logger::DEBUG] }.to_h
config.default_names... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/dry-system-sinatra/lib/example_app/view.rb | examples/dry-system-sinatra/lib/example_app/view.rb | # frozen_string_literal: true
# auto_register: false
require "dry/view"
require "slim"
require "example_app/container"
module ExampleApp
class View < Dry::View
config.paths = Container.root.join("web/templates")
config.layout = "application"
end
end
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/dry-system-sinatra/lib/example_app/web.rb | examples/dry-system-sinatra/lib/example_app/web.rb | # frozen_string_literal: true
require "sinatra/base"
require "byebug"
module ExampleApp
class Web < Sinatra::Base
get "/" do
redirect "/articles"
end
get "/articles" do
render_view "articles.index"
end
get "/articles/:slug" do |slug|
render_view "articles.show", slug: slug
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/dry-system-sinatra/lib/example_app/article_repo.rb | examples/dry-system-sinatra/lib/example_app/article_repo.rb | # frozen_string_literal: true
require "ostruct"
module ExampleApp
Article = Struct.new(:slug, :title)
class ArticleRepo
ARTICLES = [
{slug: "together-breakfast", title: "Together Breakfast"},
{slug: "cat-fingers", title: "Cat Fingers"}
].freeze
def by_slug!(slug)
if (article = ARTI... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/dry-system-sinatra/lib/example_app/views/articles/index.rb | examples/dry-system-sinatra/lib/example_app/views/articles/index.rb | # frozen_string_literal: true
require "example_app/import"
require "example_app/view"
module ExampleApp
module Views
module Articles
class Index < View
include Import["article_repo"]
config.template = "articles/index"
expose :articles do
article_repo.listing
end... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/dry-system-sinatra/lib/example_app/views/articles/show.rb | examples/dry-system-sinatra/lib/example_app/views/articles/show.rb | # frozen_string_literal: true
require "example_app/import"
require "example_app/view"
module ExampleApp
module Views
module Articles
class Show < View
include Import["article_repo"]
config.template = "articles/show"
expose :article do |slug:|
article_repo.by_slug!(slug)... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/dry-system-sinatra/lib/example_app/view/context.rb | examples/dry-system-sinatra/lib/example_app/view/context.rb | # frozen_string_literal: true
require_relative "../view"
require "dry/view/context"
module ExampleApp
class View
class Context < Dry::View::Context
def initialize(**options)
@options = options
super(**options)
end
def request_path
request.path
end
def requ... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/app/controllers/articles_controller.rb | examples/rails/app/controllers/articles_controller.rb | # frozen_string_literal: true
class ArticlesController < ApplicationController
def index
articles = Article.all
render html: Views::Articles::Index.new.(articles: articles).to_s.html_safe
end
def show
article = Article.find(params[:id])
render html: Views::Articles::Show.new.(article: article)... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/app/controllers/application_controller.rb | examples/rails/app/controllers/application_controller.rb | # frozen_string_literal: true
class ApplicationController < ActionController::Base
end
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/app/models/article.rb | examples/rails/app/models/article.rb | # frozen_string_literal: true
class Article < ApplicationRecord
end
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/app/models/application_record.rb | examples/rails/app/models/application_record.rb | # frozen_string_literal: true
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/app/views/application_view_context.rb | examples/rails/app/views/application_view_context.rb | # frozen_string_literal: true
require "dry/view/context"
class ApplicationViewContext < Dry::View::Context
def method_missing(name, *args, &block)
if url_helpers.respond_to?(name)
url_helpers.public_send(name, *args, &block)
elsif helpers.respond_to?(name)
helpers.public_send(name, *args, &block... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/app/views/application_view.rb | examples/rails/app/views/application_view.rb | # frozen_string_literal: true
class ApplicationView < Dry::View
config.paths = Rails.root.join("app/templates")
config.default_context = ApplicationViewContext.new
end
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/app/views/views/articles/index.rb | examples/rails/app/views/views/articles/index.rb | # frozen_string_literal: true
module Views
module Articles
class Index < ApplicationView
config.template = "articles/index"
expose :articles
end
end
end
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/app/views/views/articles/show.rb | examples/rails/app/views/views/articles/show.rb | # frozen_string_literal: true
module Views
module Articles
class Show < ApplicationView
config.template = "articles/show"
expose :article
end
end
end
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/db/schema.rb | examples/rails/db/schema.rb | # frozen_string_literal: true
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the auth... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/db/migrate/20190116013956_create_articles.rb | examples/rails/db/migrate/20190116013956_create_articles.rb | # frozen_string_literal: true
class CreateArticles < ActiveRecord::Migration[5.2]
def change
create_table :articles do |t|
t.string :title
t.timestamps
end
end
end
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/config/application.rb | examples/rails/config/application.rb | # frozen_string_literal: true
require_relative "boot"
require "rails"
require "active_model/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_view/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bund... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/config/environment.rb | examples/rails/config/environment.rb | # frozen_string_literal: true
# Load the Rails application.
require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/config/puma.rb | examples/rails/config/puma.rb | # frozen_string_literal: true
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for mini... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/config/routes.rb | examples/rails/config/routes.rb | # frozen_string_literal: true
Rails.application.routes.draw do
resources :articles, only: %i[index show]
root to: "articles#index"
end
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/config/boot.rb | examples/rails/config/boot.rb | # frozen_string_literal: true
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/config/environments/test.rb | examples/rails/config/environments/test.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "s... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/config/environments/development.rb | examples/rails/config/environments/development.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/examples/rails/config/environments/production.rb | examples/rails/config/environments/production.rb | # frozen_string_literal: true
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.cache_classes = true
# Eager load code on boot. This eager loads most of Rails and
# your application in memory, a... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry-view.rb | lib/dry-view.rb | # frozen_string_literal: true
require "dry/view"
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view.rb | lib/dry/view.rb | # frozen_string_literal: true
require "dry/configurable"
require "dry/core/cache"
require "dry/core/equalizer"
require "dry/inflector"
require_relative "view/context"
require_relative "view/exposures"
require_relative "view/errors"
require_relative "view/part_builder"
require_relative "view/path"
require_relative "vi... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/tilt.rb | lib/dry/view/tilt.rb | # frozen_string_literal: true
require "dry/core/cache"
require "tilt"
module Dry
class View
# @api private
module Tilt
extend Dry::Core::Cache
class << self
def [](path, mapping, **options)
ext = File.extname(path).sub(/^./, "").to_sym
activate_adapter ext
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/path.rb | lib/dry/view/path.rb | # frozen_string_literal: true
require "pathname"
require "dry/core/cache"
module Dry
class View
# @api private
class Path
extend Dry::Core::Cache
include Dry::Equalizer(:dir, :root)
attr_reader :dir, :root
def self.[](path)
if path.is_a?(self)
path
else
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/version.rb | lib/dry/view/version.rb | # frozen_string_literal: true
module Dry
class View
# @api private
VERSION = "0.8.0"
end
end
| ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/errors.rb | lib/dry/view/errors.rb | # frozen_string_literal: true
module Dry
class View
# Error raised when critical settings are not configured
#
# @api private
class UndefinedConfigError < StandardError
def initialize(key)
super("no +#{key}+ configured")
end
end
# Error raised when template could not be f... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/render_environment.rb | lib/dry/view/render_environment.rb | # frozen_string_literal: true
require "dry/core/equalizer"
module Dry
class View
# @api private
class RenderEnvironment
def self.prepare(renderer, config, context)
new(
renderer: renderer,
inflector: config.inflector,
context: context,
scope_builder: con... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/render_environment_missing.rb | lib/dry/view/render_environment_missing.rb | # frozen_string_literal: true
require "dry/inflector"
module Dry
class View
# @api private
class RenderEnvironmentMissing
class MissingEnvironmentError < StandardError
def message
"a +render_env+ must be provided"
end
end
def format
raise MissingEnvironme... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/exposure.rb | lib/dry/view/exposure.rb | # frozen_string_literal: true
require "dry/core/equalizer"
module Dry
class View
# An exposure defined on a view
#
# @api private
class Exposure
include Dry::Equalizer(:name, :proc, :object, :options)
EXPOSURE_DEPENDENCY_PARAMETER_TYPES = %i[req opt].freeze
INPUT_PARAMETER_TYPES =... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/decorated_attributes.rb | lib/dry/view/decorated_attributes.rb | # frozen_string_literal: true
require "set"
module Dry
class View
# Decorates attributes in Parts.
module DecoratedAttributes
# @api private
def self.included(klass)
klass.extend ClassInterface
end
# Decorated attributes class-level interface.
module ClassInterface
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/rendered.rb | lib/dry/view/rendered.rb | # frozen_string_literal: true
require "dry/core/equalizer"
module Dry
class View
# Output of a View rendering
#
# @api public
class Rendered
include Dry::Equalizer(:output, :locals)
# Returns the rendered view
#
# @return [String]
#
# @api public
attr_reade... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/scope.rb | lib/dry/view/scope.rb | # frozen_string_literal: true
require "dry/core/equalizer"
require "dry/core/constants"
require_relative "render_environment_missing"
module Dry
class View
# Evaluation context for templates (including layouts and partials) and
# provides a place to encapsulate view-specific behaviour alongside a
# temp... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/exposures.rb | lib/dry/view/exposures.rb | # frozen_string_literal: true
require "tsort"
require "dry/core/equalizer"
require "dry/view/exposure"
module Dry
class View
# @api private
class Exposures
include Dry::Equalizer(:exposures)
include TSort
attr_reader :exposures
def initialize(exposures = {})
@exposures = ex... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/renderer.rb | lib/dry/view/renderer.rb | # frozen_string_literal: true
require "dry/core/cache"
require "dry/core/equalizer"
require_relative "errors"
require_relative "tilt"
module Dry
class View
# @api private
class Renderer
PARTIAL_PREFIX = "_"
PATH_DELIMITER = "/"
extend Dry::Core::Cache
include Dry::Equalizer(:paths,... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/context.rb | lib/dry/view/context.rb | # frozen_string_literal: true
require "dry/core/equalizer"
require_relative "decorated_attributes"
module Dry
class View
# Provides a baseline environment across all the templates, parts and scopes
# in a given rendering.
#
# @abstract Subclass this and add your own methods (along with a custom
... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/part_builder.rb | lib/dry/view/part_builder.rb | # frozen_string_literal: true
require "dry/core/cache"
require "dry/core/equalizer"
require_relative "part"
module Dry
class View
# Decorates exposure values with matching parts
#
# @api private
class PartBuilder
extend Dry::Core::Cache
include Dry::Equalizer(:namespace)
attr_read... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/scope_builder.rb | lib/dry/view/scope_builder.rb | # frozen_string_literal: true
require "dry/core/cache"
require "dry/core/equalizer"
require_relative "scope"
module Dry
class View
# Builds scope objects via matching classes
#
# @api private
class ScopeBuilder
extend Dry::Core::Cache
include Dry::Equalizer(:namespace)
# The view'... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
dry-rb/dry-view | https://github.com/dry-rb/dry-view/blob/055026fc6f3f2840efd9301705b609ef09709f8d/lib/dry/view/part.rb | lib/dry/view/part.rb | # frozen_string_literal: true
require "dry/core/equalizer"
require_relative "decorated_attributes"
require_relative "render_environment_missing"
module Dry
class View
# Decorates an exposure value and provides a place to encapsulate
# view-specific behavior alongside your application's domain objects.
#... | ruby | MIT | 055026fc6f3f2840efd9301705b609ef09709f8d | 2026-01-04T17:33:31.103243Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.