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 |
|---|---|---|---|---|---|---|---|---|
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/time_patch.rb | lib/volt/utils/time_patch.rb | if RUBY_PLATFORM == 'opal'
require 'time'
class Time
# Patchs a bug in the Time class, where two instances of time with the same
# value do not hash to the same hash as they do in MRI.
# https://github.com/opal/opal/issues/963
def hash
"Time:#{to_i}"
end
# Patches backported Opal ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/event_counter.rb | lib/volt/utils/event_counter.rb | module Volt
# EventCounter has an #add and #remove method, and when the first one is added
# will call the #start proc (passed to new), and when the last is removed will
# call #stop.
class EventCounter
attr_reader :count
def initialize(start, stop)
@start = start
@stop = stop
@count... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/timers.rb | lib/volt/utils/timers.rb | module Volt
# The timers class provides useful methods for working in an asynchronus environment.
class Timers
# next tick (same as setImmediate) calls the block of code after any currently
# running code is finished.
def self.next_tick(&block)
if Volt.in_browser?
`setImmediate(function() ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/time_opal_patch.rb | lib/volt/utils/time_opal_patch.rb | # Copied from https://github.com/opal/opal/blob/dd81fb4bfe337c0321ef1a8f7def2a3049a3fd83/opal/corelib/time.rb
# This patches time to the level in Opal 0.9.0 so that Volt can continue to run against Opal 0.8.0 and
# implement VoltTime
require 'corelib/comparable'
class Time
include Comparable
%x{
var days_o... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/parsing.rb | lib/volt/utils/parsing.rb | module Volt
module Parsing
def self.decodeURI(value)
if RUBY_PLATFORM == 'opal'
`decodeURI(value)`
else
CGI.unescape(value.to_s)
end
end
def self.encodeURI(value)
if RUBY_PLATFORM == 'opal'
`encodeURI(value)`
else
CGI.escape(value.to_s)
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/read_write_lock.rb | lib/volt/utils/read_write_lock.rb | # Currently the released gem version of the concurrent-ruby gem does not have the ReadWriteLock
# relased in it (it is on master).
# Ruby read-write lock implementation
# Allows any number of concurrent readers, but only one concurrent writer
# (And if the "write" lock is taken, any readers who come along will have to... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/recursive_exists.rb | lib/volt/utils/recursive_exists.rb | module Volt
module RecursiveExists
def self.exists_here_or_up?(file)
# Check for a gemfile here or up a directory
pwd = Dir.pwd
loop do
if File.exists?("#{pwd}/#{file}")
return true
else
pwd = pwd.gsub(/\/[^\/]+$/, '')
return false if pwd == ''
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/data_transformer.rb | lib/volt/utils/data_transformer.rb | # DataTransformer is a singleton class that walks ruby data structures (nested
# hashes, arrays, etc..) and lets you transform them based on values or keys
#
# NOTE: DataTransformer is not automatically required, but can be when needed.
module Volt
class DataTransformer
# Takes a hash or array, and nested map's ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/generic_counting_pool.rb | lib/volt/utils/generic_counting_pool.rb | require 'volt/utils/generic_pool'
module Volt
# A counting pool behaves like a normal GenericPool, except for
# each time lookup is called, remove should be called when complete.
# The item will be completely removed from the GenericCountingPool
# only when it has been removed an equal number of times it has b... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/local_storage.rb | lib/volt/utils/local_storage.rb | if RUBY_PLATFORM == 'opal'
module Volt
module LocalStorage
def self.[](key)
`
var val = localStorage.getItem(key);
return val === null ? nil : val;
`
end
def self.[]=(key, value)
`localStorage.setItem(key, value)`
end
def self.clear
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/boolean_patch.rb | lib/volt/utils/boolean_patch.rb | # A patch to fix https://github.com/opal/opal/issues/801 until it is fixed in (0.8)
if RUBY_PLATFORM == 'opal'
class Boolean
def hash
self ? 'Boolean:true' : 'Boolean:false'
end
end
end
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/volt_user_error.rb | lib/volt/utils/volt_user_error.rb | # VoltUserError is a base class for Volt errors that you don't need backtraces on.
# These are errors that you simply need to communicate something to developer with.
class VoltUserError < RuntimeError
end
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/logging/task_logger.rb | lib/volt/utils/logging/task_logger.rb | require 'volt/utils/logging/task_argument_filterer'
module Volt
class TaskLogger
def self.task_dispatch_message(logger, args)
msg = "task #{logger.class_name}##{logger.method_name} in #{logger.run_time}\n"
if args.size > 0
arg_str = TaskArgumentFilterer.filter(args).map(&:inspect).join(', ')
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/logging/task_argument_filterer.rb | lib/volt/utils/logging/task_argument_filterer.rb | # TaskArgumentFilterer will recursively walk any arguemnts to a task and filter any
# hashes with a filtered key. By default only :password is filtered, but you can add
# more with Volt.config.filter_keys
class TaskArgumentFilterer
def self.filter(args)
new(args).run
end
def initialize(args)
# # Cache t... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/reactive/hash_dependency.rb | lib/volt/reactive/hash_dependency.rb | module Volt
class HashDependency
def initialize
@hash_depedencies = {}
end
def depend(key)
ensure_key(key).depend
end
def changed!(key)
ensure_key(key).changed!
end
def delete(key)
dep = @hash_depedencies.delete(key)
if dep
dep.changed!
dep... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/reactive/reactive_accessors.rb | lib/volt/reactive/reactive_accessors.rb | module Volt
module ReactiveAccessors
module ClassMethods
# Create a method to read a reactive value from an instance value. If it
# is not setup, create it so it can be updated through the reactive value
# at a later point.
def reactive_reader(*names)
names.each do |name|
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/reactive/reactive_array.rb | lib/volt/reactive/reactive_array.rb | require 'volt/reactive/eventable'
module Volt
class ReactiveArray
include Eventable
def initialize(array = [])
@array = array
@array_deps = []
@size_dep = Dependency.new
@old_size = 0
end
def respond_to_missing?(method_name, include_private = false)
@array.res... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/reactive/reactive_hash.rb | lib/volt/reactive/reactive_hash.rb | require 'volt/reactive/hash_dependency'
module Volt
class ReactiveHash
def initialize(values = {})
@hash = values
@deps = HashDependency.new
@all_deps = Dependency.new
end
def ==(val)
@all_deps.depend
@hash == val
end
def blank?
@hash.blank?
end
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/reactive/eventable.rb | lib/volt/reactive/eventable.rb | module Volt
# Listeners are returned from #on on a class with Eventable included.
# Listeners can be stopped by calling #remove
class Listener
attr_reader :events
def initialize(klass, events, callback)
@klass = klass
@events = events
@callback = callback
end
def call(*arg... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/reactive/class_eventable.rb | lib/volt/reactive/class_eventable.rb | require 'volt/reactive/eventable'
module Volt
# ClassEventable behaves like Eventable, except events can be bound with a class #on method.
# When triggered on an instance, the self in the block will be the instance it was triggered
# on. This allows classes to easy setup listeners.
#
# Example:
# class... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/reactive/dependency.rb | lib/volt/reactive/dependency.rb | require 'set'
module Volt
# Dependencies are used to track the current computation so it can be re-run
# at a later point if this dependency changes.
#
# You can also pass an on_dep and on_stop_dep proc's to #initialize.
class Dependency
# Setup a new dependency.
#
# @param on_dep [Proc] a proc t... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/reactive/computation.rb | lib/volt/reactive/computation.rb | require 'set'
module Volt
class Computation
@@current = nil
@@flush_queue = Set.new
def self.current=(val)
@@current = val
end
def self.current
@@current
end
# @param [Proc] the code to run when the computation needs to compute
def initialize(computation)
@com... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/assets/test.rb | lib/volt/assets/test.rb | require 'sass'
sass_engine = Sass::Engine.new(template, syntax: :scss, filename: 'cool.css.scss', sourcemap: true); output =
sass_engine.render_with_sourcemap('/source_maps/')
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/spec/capybara.rb | lib/volt/spec/capybara.rb | require 'volt/spec/sauce_labs'
module Volt
class << self
def setup_capybara(app_path, volt_app = nil)
browser = ENV['BROWSER']
if browser
setup_capybara_app(app_path, volt_app)
case browser
when 'phantom'
Capybara.default_driver = :poltergeist
when 'chrome'... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/spec/setup.rb | lib/volt/spec/setup.rb | require 'volt/volt/core' if RUBY_PLATFORM != 'opal'
module Volt
class << self
def spec_setup(app_path = '.')
require 'volt'
ENV['SERVER'] = 'true'
ENV['VOLT_ENV'] = 'test'
require 'volt/boot'
# Create a main volt app for tests
volt_app = Volt.boot(app_path)
unless RU... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/spec/sauce_labs.rb | lib/volt/spec/sauce_labs.rb | module Volt
class << self
def setup_sauce_labs
require 'sauce'
require 'sauce/capybara'
Sauce.config do |c|
if ENV['OS']
# Use a specifc OS, BROWSER, VERSION combo (for travis)
c[:browsers] = [
[ENV['OS'], ENV['USE_BROWSER'], ENV['VERSION']]
]
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/volt/core.rb | lib/volt/volt/core.rb | # Require in the core volt classes that get used on the server
require 'volt/controllers/http_controller'
require 'volt/server/rack/http_request'
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/volt/users.rb | lib/volt/volt/users.rb | require 'thread'
module Volt
class << self
# Get the user_id from the cookie
def current_user_id
# Check for a user_id from with_user
if (user_id = Thread.current['with_user_id'])
return user_id
end
user_id_signature = self.user_id_signature
if user_id_signature.nil?
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/volt/environment.rb | lib/volt/volt/environment.rb | module Volt
class Environment
def initialize
# Use VOLT_ENV or RACK_ENV to set the environment
@env = ENV['VOLT_ENV'] || ENV['RACK_ENV']
# If we're in opal, we can set the env from JS before opal loads
if RUBY_PLATFORM == 'opal'
unless @env
`if (window.start_env) {`
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/volt/templates.rb | lib/volt/volt/templates.rb | # The Templates class holds all loaded templates.
module Volt
class Templates
# On the server, we can delay loading the views until they are actually requeted. This
# sets up an instance variable to call to load.
attr_writer :template_loader
def initialize
@templates = {}
end
def [](k... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/volt/app.rb | lib/volt/volt/app.rb | require 'opal'
# On the server, setup the server env by default
unless RUBY_PLATFORM == 'opal'
ENV['SERVER'] ||= 'true'
end
# on the client, we want to include the main volt.rb file
require 'volt'
require 'volt/models'
require 'volt/controllers/model_controller'
require 'volt/tasks/task'
require 'volt/page/bindings... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/volt/properties.rb | lib/volt/volt/properties.rb | # Volt.current_app.properties provides a hash like collection that backs to
# the database. This is useful for storing global app property. (A common use
# might be checking if something like an S3 bucket has been created without
# the need to make an external API request.)
class Properties
def [](key)
end
de... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/volt/repos.rb | lib/volt/volt/repos.rb | # The Volt::Repos module provides access to each root collection (repo).
module Volt
module Repos
def url
@url ||= URL.new
end
def params
@params ||= @url.params
end
def page
@page ||= PageRoot.new
end
def store
@store ||= StoreRoot.new({}, persistor: Persistors... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/volt/client_setup/browser.rb | lib/volt/volt/client_setup/browser.rb | require 'volt/utils/ejson'
module Volt
class Browser
attr_reader :events
def initialize(volt_app)
@volt_app = volt_app
# Run the code to setup the page
@url_tracker = UrlTracker.new(@volt_app)
@events = DocumentEvents.new
# Initialize tasks so we can get the reload message
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/volt/server_setup/app.rb | lib/volt/volt/server_setup/app.rb | # The following setup handles setting up the app on the server.
unless RUBY_PLATFORM == 'opal'
require 'volt/server/message_bus/peer_to_peer'
require 'volt/server/middleware/middleware_stack'
require 'volt/server/middleware/default_middleware_stack'
require 'volt/volt/core'
end
module Volt
module ServerSetu... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/channel_stub.rb | lib/volt/page/channel_stub.rb | # Acts the same as the Channel class on the front-end, but calls
# directly instead of using sockjs.
require 'volt/tasks/dispatcher'
require 'volt/reactive/eventable'
module Volt
# Behaves the same as the Channel class, only the Channel class uses
# sockjs to pass messages to the backend. ChannelStub, simply pas... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/channel.rb | lib/volt/page/channel.rb | # The channel is the connection between the front end and the backend.
require 'volt/utils/ejson'
require 'volt/reactive/reactive_accessors'
require 'volt/reactive/eventable'
module Volt
class Channel
include ReactiveAccessors
include Eventable
reactive_accessor :connected, :status, :error, :reconnect_... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/document_events.rb | lib/volt/page/document_events.rb | module Volt
class DocumentEvents
def initialize
@events = {}
end
def add(event, binding, handler)
# Track each document event based on the event, element id, then binding.object_id
unless @events[event]
# We haven't defined an event of type event yet, lets attach it to the
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/url_tracker.rb | lib/volt/page/url_tracker.rb | module Volt
# The URLTracker is responsible for updating the url when
# a param changes, or updating the url model/params when
# the browser url changes.
class UrlTracker
def initialize(volt_app)
@volt_app = volt_app
if Volt.client?
that = self
# Setup popstate on the dom ready... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/sub_context.rb | lib/volt/page/sub_context.rb | module Volt
# A sub context takes in a hash of local variables that should be available
# in front of the current context. It basically proxies the local variables
# first, then failing those proxies the context.
#
# SubContext is also used for the attrs in controllers. You can pass return_nils
# to have ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/template_renderer.rb | lib/volt/page/template_renderer.rb | require 'volt/page/bindings/base_binding'
module Volt
class TemplateRenderer < BaseBinding
attr_reader :context
def initialize(volt_app, target, context, binding_name, template_name)
super(volt_app, target, context, binding_name)
@sub_bindings = []
bindings = dom_section.set_content_to_t... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/path_string_renderer.rb | lib/volt/page/path_string_renderer.rb | # The PathRenderer is a simple way to render a string of the contents of a view
# at the passed in path.
require 'volt/page/bindings/view_binding/view_lookup_for_path'
require 'volt/page/bindings/view_binding/controller_handler'
require 'volt/page/string_template_renderer'
module Volt
class ViewLookupException < Ex... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/tasks.rb | lib/volt/page/tasks.rb | require 'volt/utils/ejson'
module Volt
# The tasks class provides an interface to call tasks on
# the backend server. This class is setup as page.task (as a singleton)
class Tasks
def initialize(volt_app)
@volt_app = volt_app
@promise_id = 0
@promises = {}
volt_app.channel.o... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/document.rb | lib/volt/page/document.rb | module Volt
# Should have
# templates
# events
class Document
end
end
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/string_template_renderer.rb | lib/volt/page/string_template_renderer.rb | module Volt
# StringTemplateRenderer are used to render a template to a string. Call .html
# to get the string. Be sure to call .remove when complete.
#
# StringTemplateRenderer will intellegently update the string in the same way
# a normal bindings will update the dom.
class StringTemplateRenderer
d... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/targets/dom_section.rb | lib/volt/page/targets/dom_section.rb | require 'volt/page/targets/base_section'
require 'volt/page/targets/helpers/comment_searchers'
module Volt
class DomSection < BaseSection
include CommentSearchers
def initialize(binding_name)
@start_node = find_by_comment("$#{binding_name}")
@end_node = find_by_comment("$/#{binding_name}")
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/targets/attribute_section.rb | lib/volt/page/targets/attribute_section.rb | # AttributeSection provides a place to render templates that
# will be placed as text into an attribute.
require 'volt/page/targets/base_section'
module Volt
class AttributeSection < BaseSection
def initialize(target, binding_name)
@target = target
@binding_name = binding_name
end
def... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/targets/dom_template.rb | lib/volt/page/targets/dom_template.rb | require 'volt/page/targets/helpers/comment_searchers'
module Volt
# A dom template is used to optimize going from a template name to
# dom nodes and bindings. It stores a copy of the template's parsed
# dom nodes, then when a new instance is requested, it updates the
# dom markers (comments) for new binding n... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/targets/dom_target.rb | lib/volt/page/targets/dom_target.rb | require 'volt/page/targets/base_section'
require 'volt/page/targets/dom_section'
module Volt
# DomTarget's provide an interface that can render bindings into
# the dom. Currently only one "dom" is supported, but multiple
# may be allowed in the future (iframes?)
class DomTarget < BaseSection
def dom_secti... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/targets/attribute_target.rb | lib/volt/page/targets/attribute_target.rb | require 'volt/page/targets/base_section'
require 'volt/page/targets/attribute_section'
require 'volt/page/targets/binding_document/component_node'
require 'volt/page/targets/binding_document/html_node'
module Volt
# AttributeTarget's provide an interface that can render bindings into
# a string that can then be us... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/targets/base_section.rb | lib/volt/page/targets/base_section.rb | require 'volt/page/targets/dom_template'
module Volt
# Class to describe the interface for sections
class BaseSection
@@template_cache = {}
def remove
fail 'remove is not implemented'
end
def remove_anchors
fail 'remove_anchors is not implemented'
end
def insert_anchor_before... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/targets/binding_document/html_node.rb | lib/volt/page/targets/binding_document/html_node.rb | require 'volt/page/targets/binding_document/base_node'
module Volt
class HtmlNode < BaseNode
def initialize(html)
@html = html
end
def to_html
@html
end
def inspect
"<HtmlNode #{@html.inspect}>"
end
end
end
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/targets/binding_document/tag_node.rb | lib/volt/page/targets/binding_document/tag_node.rb | # The tag node represents an html tag with a binding id in it. It provides an
# api to change attribute values.
require 'volt/page/targets/binding_document/base_node'
module Volt
class TagNode < BaseNode
# We use some of the same parts from the sandlebars parser, but since this
# has to ship to the client,... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/targets/binding_document/base_node.rb | lib/volt/page/targets/binding_document/base_node.rb | module Volt
class BaseNode
end
end
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/targets/binding_document/component_node.rb | lib/volt/page/targets/binding_document/component_node.rb | require 'volt/page/targets/binding_document/html_node'
require 'volt/page/targets/binding_document/tag_node'
require 'volt/reactive/eventable'
module Volt
# Component nodes contain an array of HtmlNodes, TagNodes and ComponentNodes.
# Instead of providing a full DOM API, component nodes are the branch
# nodes an... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/targets/helpers/comment_searchers.rb | lib/volt/page/targets/helpers/comment_searchers.rb | module Volt
module CommentSearchers
if RUBY_PLATFORM == 'opal'
NO_XPATH = `!!window._phantom || !document.evaluate`
else
NO_XPATH = false
end
def find_by_comment(text, in_node = `document`)
if NO_XPATH
find_by_comment_without_xml(text, in_node)
else
node = nil
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/bindings.rb | lib/volt/page/bindings/bindings.rb | # A file to require all client side bindings
require 'volt/page/bindings/attribute_binding'
require 'volt/page/bindings/content_binding'
require 'volt/page/bindings/each_binding'
require 'volt/page/bindings/if_binding'
require 'volt/page/bindings/view_binding'
require 'volt/page/bindings/yield_binding'
require 'volt/pa... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/yield_binding.rb | lib/volt/page/bindings/yield_binding.rb | # The yield binding renders the content of a tag which passes in
require 'volt/page/bindings/base_binding'
require 'volt/page/template_renderer'
module Volt
class YieldBinding < BaseBinding
def initialize(volt_app, target, context, binding_name)
super(volt_app, target, context, binding_name)
# Get ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/content_binding.rb | lib/volt/page/bindings/content_binding.rb | require 'volt/page/bindings/base_binding'
require 'volt/page/bindings/html_safe/string_extension'
module Volt
class ContentBinding < BaseBinding
HTML_ESCAPE_REGEXP = /[&"'><\n]/
HTML_ESCAPE = { '&' => '&', '>' => '>', '<' => '<', '"' => '"', "'" => ''', "\n" => "<br />\n" }
def ini... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/event_binding.rb | lib/volt/page/bindings/event_binding.rb | require 'volt/page/bindings/base_binding'
module Volt
# TODO: We need to figure out how we want to wrap JS events
class JSEvent
attr_reader :js_event
# The Volt controller that dispatched the event.
attr_accessor :controller
def initialize(js_event)
@js_event = js_event
end
def key... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/component_binding.rb | lib/volt/page/bindings/component_binding.rb | require 'volt/page/bindings/view_binding'
# Component bindings are the same as template bindings, but handle components.
module Volt
class ComponentBinding < ViewBinding
end
end
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/each_binding.rb | lib/volt/page/bindings/each_binding.rb | require 'volt/page/bindings/base_binding'
module Volt
class InvalidObjectForEachBinding < Exception ; end
class EachBinding < BaseBinding
def initialize(volt_app, target, context, binding_name, getter, variable_name, index_name, template_name)
super(volt_app, target, context, binding_name)
@item_... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/view_binding.rb | lib/volt/page/bindings/view_binding.rb | require 'volt/page/bindings/base_binding'
require 'volt/page/template_renderer'
require 'volt/page/bindings/view_binding/grouped_controllers'
require 'volt/page/bindings/view_binding/view_lookup_for_path'
require 'volt/page/bindings/view_binding/controller_handler'
module Volt
class ViewBinding < BaseBinding
# @... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/if_binding.rb | lib/volt/page/bindings/if_binding.rb | require 'volt/page/bindings/base_binding'
module Volt
class IfBinding < BaseBinding
def initialize(volt_app, target, context, binding_name, branches)
super(volt_app, target, context, binding_name)
getter, template_name = branches[0]
@branches = []
@listeners = []
branches.each d... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/attribute_binding.rb | lib/volt/page/bindings/attribute_binding.rb | require 'volt/page/bindings/base_binding'
require 'volt/page/targets/attribute_target'
module Volt
class AttributeBinding < BaseBinding
def initialize(volt_app, target, context, binding_name, attribute_name, getter, setter)
super(volt_app, target, context, binding_name)
@attribute_name = attribute_n... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/base_binding.rb | lib/volt/page/bindings/base_binding.rb | # The BaseBinding class is the base for all bindings. It takes
# 4 arguments that should be passed up from the children (via super)
#
# 1. page - this class instance should provide:
# - a #templates methods that returns a hash for templates
# - an #events methods that returns an instance of Docum... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/view_binding/view_lookup_for_path.rb | lib/volt/page/bindings/view_binding/view_lookup_for_path.rb | module Volt
# ViewFinderForPath helps find the location of view file given
# a template path.
class ViewLookupForPath
# Takes in the path of the current view file. This allows for relative paths
# to be run.
#
# @param [Hash] the templates object from a Volt::App
# @param [String] the path of... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/view_binding/controller_handler.rb | lib/volt/page/bindings/view_binding/controller_handler.rb | module Volt
class ControllerHandler
attr_reader :controller, :action
# Checks to see if a controller has a handler, and if not creates one.
def self.fetch(controller, action)
inst = controller.instance_variable_get('@__handler')
unless inst
inst = new(controller, action)
cont... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/view_binding/grouped_controllers.rb | lib/volt/page/bindings/view_binding/grouped_controllers.rb | # Some template bindings share the controller with other template bindings based
# on a name. This class creates a cache based on the group_controller name and the
# controller class.
module Volt
class GroupedControllers
def initialize(name)
@name = name
@@pool ||= GenericCountingPool.new
end
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/page/bindings/html_safe/string_extension.rb | lib/volt/page/bindings/html_safe/string_extension.rb | class String
def html_safe
# Convert to a real string (opal uses native strings normally, so wrap so we can
# use instance variables)
str = String.new(self)
str.instance_variable_set('@html_safe', true)
str
end
def html_safe?
@html_safe
end
end
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/component_templates.rb | lib/volt/server/component_templates.rb | require 'volt/server/html_parser/view_parser'
require 'volt/tasks/task'
require 'volt/server/template_handlers/preprocessors'
# Initialize with the path to a component and returns all the front-end
# setup code (for controllers, models, views, and routes)
module Volt
class BasicHandler
def call(file_contents)
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/forking_server.rb | lib/volt/server/forking_server.rb | #
require 'drb'
require 'stringio'
require 'listen'
class ErrorDispatcher
def dispatch(channel, message)
Volt.logger.error("The app failed to start, so the following message can not be run: #{message}")
end
def close_channel(channel)
end
end
module Volt
class ForkingServer
def initialize(server)
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/socket_connection_handler_stub.rb | lib/volt/server/socket_connection_handler_stub.rb | module Volt
class SocketConnectionHandlerStub
def self.dispatcher=(val)
@@dispatcher = val
end
def self.dispatcher
@@dispatcher
end
def initialize(channel_stub)
@channel_stub = channel_stub
end
# Sends a message to all, optionally skipping a users channel
def self.... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/socket_connection_handler.rb | lib/volt/server/socket_connection_handler.rb | require 'volt/utils/ejson'
require File.join(File.dirname(__FILE__), '../../../app/volt/tasks/query_tasks')
module Volt
class SocketConnectionHandler
# Create one instance of the dispatcher
# We track the connected user_id with the channel for use with permissions.
# This may be changed as new listeners... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/sprockets_helpers_setup.rb | lib/volt/server/rack/sprockets_helpers_setup.rb | require 'sprockets-helpers'
module Volt
class SprocketsHelpersSetup
def initialize(volt_app)
@volt_app = volt_app
@env = volt_app.sprockets
setup_path_helpers
add_linking_in_asset_path
end
def setup_path_helpers
digest = Volt.env.production?
# Configure Sprockets::H... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/index_files.rb | lib/volt/server/rack/index_files.rb | require 'volt/server/rack/asset_files'
require 'volt/router/routes'
# Serves the main pages
module Volt
class IndexFiles
def initialize(rack_app, volt_app, component_paths, opal_files)
@rack_app = rack_app
@volt_app = volt_app
@component_paths = component_paths
@opal_files ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/component_paths.rb | lib/volt/server/rack/component_paths.rb | # ComponentPaths gives an array of every folder where you find a component.
require 'volt/server/rack/component_code'
module Volt
class ComponentPaths
def initialize(root = nil)
@root = root || Dir.pwd
end
# Yield for every folder where we might find components
def app_folders
# Find all... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/http_response_header.rb | lib/volt/server/rack/http_response_header.rb | require 'volt'
module Volt
# Wrapper around a Hash for easy http header creation / manipulation with
# indifferent access.
# header[:content_type] == header['Content-Type'] ==
# header['content-type'] == header ['Content_Type']
class HttpResponseHeader < Hash
def []=(key, value)
super(key.to_s.head... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/http_content_types.rb | lib/volt/server/rack/http_content_types.rb | # Middleware for parsing params of different restful content in HTTP endpoints.
# Content-type: application/json - is supported out of the box
#
# Much thanks to @achiu (https://github.com/achiu) for original version of this middleware
#
# New Parsers can be added in your app's config:
# Volt.setup do |config|
# ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/keep_alive.rb | lib/volt/server/rack/keep_alive.rb | module Rack
# TODO: For some reason in Rack (or maybe thin), 304 headers close
# the http connection. We might need to make this check if keep
# alive was in the request.
class KeepAlive
def initialize(app)
@app = app
end
def call(env)
status, headers, body = @app.call(env)
if s... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/http_request.rb | lib/volt/server/rack/http_request.rb | require 'volt'
require 'rack' if RUBY_PLATFORM != 'opal'
module Volt
# A request object for a HttpController. See Rack::Request for more details
class HttpRequest < Rack::Request
# Returns the request format
# /acticles/index.html => html
# Defaults to the media_type of the request
def format
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/source_map_server.rb | lib/volt/server/rack/source_map_server.rb | module Volt
class SourceMapServer
def initialize(sprockets)
@sprockets = sprockets
end
attr_reader :sprockets
attr_writer :prefix
def prefix
@prefix ||= '/__opal_source_maps__'
end
def inspect
"#<#{self.class}:#{object_id}>"
end
def call(env)
path_info ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/http_response_renderer.rb | lib/volt/server/rack/http_response_renderer.rb | require 'json'
require 'volt'
module Volt
# Renders responses for HttpController actions
class HttpResponseRenderer
@renderers = {}
class << self
attr_reader :renderers
end
# Register renderers.
def self.register_renderer(name, content_type, proc)
@renderers[name.to_sym] = { proc:... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/asset_files.rb | lib/volt/server/rack/asset_files.rb | require 'uri'
# Used to get a list of the assets and other included components
# from the dependencies.rb files.
module Volt
class AssetFiles
def self.from_cache(app_url, component_name, component_paths)
# @cache ||= {}
# @cache[component_name] ||= begin
# not cached, create
self.ne... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/http_resource.rb | lib/volt/server/rack/http_resource.rb | require 'rack' if RUBY_PLATFORM != 'opal'
require 'volt'
require 'volt/router/routes'
require 'volt/server/rack/http_request'
module Volt
# Rack middleware for HttpController
class HttpResource
def initialize(app, volt_app, router)
@app = app
@volt_app = volt_app
@router = router
end
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/quiet_common_logger.rb | lib/volt/server/rack/quiet_common_logger.rb | require 'rack'
class QuietCommonLogger < Rack::CommonLogger
include Rack
@@ignore_extensions = %w(png jpg jpeg ico gif woff tff svg eot css js)
def call(env)
path = env['PATH_INFO']
began_at = Time.now
status, header, body = @app.call(env)
header = Utils::HeaderHash.new(header)
base = ::File... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/component_code.rb | lib/volt/server/rack/component_code.rb | require 'volt/server/html_parser/view_parser'
require 'volt/server/component_templates'
require 'volt/server/rack/asset_files'
# Takes in the name and all component paths returns all of the ruby code for the
# component and its dependencies.
module Volt
class ComponentCode
def initialize(volt_app, component_name... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/rack/opal_files.rb | lib/volt/server/rack/opal_files.rb | require 'volt/server/rack/source_map_server'
# There is currently a weird issue with therubyracer
# https://github.com/rails/execjs/issues/15
# https://github.com/middleman/middleman/issues/1367
#
# To get around this, we just force Node for the time being
ENV['EXECJS_RUNTIME'] = 'Node'
# Sets up the maps for the opa... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/middleware/middleware_stack.rb | lib/volt/server/middleware/middleware_stack.rb | # Volt::MiddlewareStack provides an interface where app code can add custom
# rack middleware. Volt.current_app.middleware returns an instance of
# Volt::MiddlewareStack, and apps can call #use to add in more middleware.
module Volt
class MiddlewareStack
attr_reader :middlewares
def initialize
# Setu... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/middleware/default_middleware_stack.rb | lib/volt/server/middleware/default_middleware_stack.rb | # Responsible for setting up all "out of the box" middleware on a Volt app.
require 'rack'
require 'volt/server/rack/keep_alive'
require 'volt/server/rack/quiet_common_logger'
require 'volt/server/rack/opal_files'
require 'volt/server/rack/index_files'
require 'volt/server/rack/http_resource'
require 'volt/server/rack... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/message_bus/base_message_bus.rb | lib/volt/server/message_bus/base_message_bus.rb | # Volt supports the concept of a message bus, a bus provides a pub/sub interface
# to any other volt instance (server, console, runner, etc..) inside a volt
# cluster. Volt ships with a PeerToPeer message bus out of the box, but you
# can create or use other message bus's.
#
# MessageBus instances inherit from Message... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/message_bus/redis.rb | lib/volt/server/message_bus/redis.rb | require 'volt/server/message_bus/base_message_bus'
| ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/message_bus/peer_to_peer.rb | lib/volt/server/message_bus/peer_to_peer.rb | # The message bus in volt is responsible for passing messages between each of
# the running app servers (or console, etc...)
# MessageBus::PeerToPeer is a simple message bus that automatically connects
# any volt instance using the same database into a cluster. It can then do
# pub/sub between all instances.
#
# How I... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/message_bus/message_encoder.rb | lib/volt/server/message_bus/message_encoder.rb | # The message encoder handles reading/writing the message to/from the socket.
# This includes encrypting and formatting.
module Volt
module MessageBus
class MessageEncoder
attr_reader :encrypted
def initialize
# rbnacl is not supported on windows.
windows = Gem.win_platform?
i... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/message_bus/peer_to_peer/peer_server.rb | lib/volt/server/message_bus/peer_to_peer/peer_server.rb | # The peer server opens a socket on a port that other instances (volt server,
# runner, etc...)
require 'socket'
require 'thread'
require 'volt/server/message_bus/peer_to_peer/peer_connection'
module Volt
module MessageBus
class NoAvailablePortException < Exception ; end
class PeerServer
def initialize... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/message_bus/peer_to_peer/peer_connection.rb | lib/volt/server/message_bus/peer_to_peer/peer_connection.rb | # PeerConnection manages the connection to a peer, it takes a socket and
# optionally the ip and port it connected to. If ip and port are given, it
# will try to reconnect until the server is marked as dead (as checked by
# message_bus.still_alive?)
require 'thread'
require 'volt/server/message_bus/peer_to_peer/socke... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/message_bus/peer_to_peer/server_tracker.rb | lib/volt/server/message_bus/peer_to_peer/server_tracker.rb | # The server tracker uses the database to keep a list of all active servers (or
# console, runners, etc...). When an server instance starts, it registers with
# the database, then reads the list of all other active servers.
require 'socket'
module Volt
module MessageBus
class ServerTracker
UPDATE_INTERVA... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/message_bus/peer_to_peer/socket_with_timeout.rb | lib/volt/server/message_bus/peer_to_peer/socket_with_timeout.rb | # Connect to a socket using the raw timeout, which responds better than the
# builtin Timeout.
require 'socket'
module Volt
class SocketWithTimeout
def self.new(host, port, timeout=nil)
if RUBY_PLATFORM == 'java'
TCPSocket.new(host, port)
else
addr = Socket.getaddrinfo(host, nil)
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/html_parser/each_scope.rb | lib/volt/server/html_parser/each_scope.rb | module Volt
class EachScope < ViewScope
def initialize(handler, path, content, with_index)
super(handler, path)
if with_index
@content, @variable_name = content.split(/.each_with_index\s+do\s+\|/)
@variable_name, @index_name = @variable_name.gsub(/\|/, '').split(/\s*,\s*/)
else
... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
voltrb/volt | https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server/html_parser/sandlebars_parser.rb | lib/volt/server/html_parser/sandlebars_parser.rb | require 'strscan'
module Volt
class HTMLParseError < RuntimeError
end
# Parses html and bindings
# based on http://ejohn.org/files/htmlparser.js
#
# takes the html and a handler object that will have the following methods
# called as each is seen: comment, text, binding, start_tag, end_tag
#
# This ... | ruby | MIT | f942b92385adbc894ee4a37903ee6a9c1a65e9a4 | 2026-01-04T15:51:19.582691Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.