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/templates/project/app/main/controllers/main_controller.rb
templates/project/app/main/controllers/main_controller.rb
# By default Volt generates this controller for your Main component module Main class MainController < Volt::ModelController def index # Add code for when the index view is loaded end def about # Add code for when the about view is loaded end private # The main template contains...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/project/app/main/models/user.rb
templates/project/app/main/models/user.rb
# By default Volt generates this User model which inherits from Volt::User, # you can rename this if you want. class User < Volt::User # login_field is set to :email by default and can be changed to :username # in config/app.rb field login_field field :name validate login_field, unique: true, length: 8 val...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/project/app/main/config/routes.rb
templates/project/app/main/config/routes.rb
# See https://github.com/voltrb/volt#routes for more info on routes client '/about', action: 'about' # Routes for login and signup, provided by user_templates component gem client '/signup', component: 'user_templates', controller: 'signup' client '/login', component: 'user_templates', controller: 'login', action: 'i...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/project/app/main/config/dependencies.rb
templates/project/app/main/config/dependencies.rb
# Specify which components you wish to include when # the "home" component loads. # bootstrap css framework component 'bootstrap' # a default theme for the bootstrap framework component 'bootstrap_jumbotron_theme' # provides templates for login, signup, and logout component 'user_templates'
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/project/app/main/config/initializers/boot.rb
templates/project/app/main/config/initializers/boot.rb
# Place any code you want to run when the component is included on the client # or server. # To include code only on the client use: # if RUBY_PLATFORM == 'opal' # # To include code only on the server, use: # unless RUBY_PLATFORM == 'opal' # ^^ this will not send compile in code in the conditional to the client. # ^^ ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/project/spec/spec_helper.rb
templates/project/spec/spec_helper.rb
# Volt sets up rspec and capybara for testing. require 'volt/spec/setup' Volt.spec_setup RSpec.configure do |config| config.run_all_when_everything_filtered = true config.filter_run :focus # Run specs in random order to surface order dependencies. If you find an # order dependency and want to debug it, you ca...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/project/spec/app/main/tasks/sample_task_spec.rb
templates/project/spec/app/main/tasks/sample_task_spec.rb
require 'spec_helper' describe 'sample task', type: :task do # Specs here end
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/project/spec/app/main/integration/sample_integration_spec.rb
templates/project/spec/app/main/integration/sample_integration_spec.rb
require 'spec_helper' describe 'sample integration test', type: :feature do # An example integration spec, this will only be run if ENV['BROWSER'] is # specified. Current values for ENV['BROWSER'] are 'firefox' and 'phantom' it 'should load the page' do visit '/' expect(page).to have_content('Home') ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/project/spec/app/main/controllers/server/sample_http_controller_spec.rb
templates/project/spec/app/main/controllers/server/sample_http_controller_spec.rb
require 'spec_helper' describe 'sample http controller test', type: :http_controller do # Specs here end
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/project/spec/app/main/models/sample_model_spec.rb
templates/project/spec/app/main/models/sample_model_spec.rb
require 'spec_helper' describe 'sample model' do # Specs here end
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/project/config/initializers/boot.rb
templates/project/config/initializers/boot.rb
# Any ./config/initializers/*.rb files will when the app starts up on the server. # To load code on the client (or client and server), you can use the # config/initializers folder in a component in the app directory. This folder # is only for things that are server only. (Usually for things like config)
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/newgem/app/newgem/config/routes.rb
templates/newgem/app/newgem/config/routes.rb
# Component routes
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/newgem/app/newgem/config/dependencies.rb
templates/newgem/app/newgem/config/dependencies.rb
# Component dependencies
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/newgem/app/newgem/config/initializers/boot.rb
templates/newgem/app/newgem/config/initializers/boot.rb
# Place any code you want to run when the component is included on the client # or server. # To include code only on the client use: # if RUBY_PLATFORM == 'opal' # # To include code only on the server, use: # unless RUBY_PLATFORM == 'opal' # ^^ this will not send compile in code in the conditional to the client. # ^^ ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/newgem/spec/integration/sample_integration_spec.rb
templates/newgem/spec/integration/sample_integration_spec.rb
require 'spec_helper' describe 'sample integration test', type: :feature do # An example integration spec, this will only be run if ENV['BROWSER'] is # specified. Current values for ENV['BROWSER'] are 'firefox' and 'phantom' it 'should load the page' do visit '/' expect(page).to have_content('Home') ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/component/config/routes.rb
templates/component/config/routes.rb
# See https://github.com/voltrb/volt#routes for more info on routes
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/component/config/dependencies.rb
templates/component/config/dependencies.rb
# Specify which components you wish to include when # this component loads.
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/templates/component/config/initializers/boot.rb
templates/component/config/initializers/boot.rb
# Place any code you want to run when the component is included on the client # or server. # To include code only on the client use: # if RUBY_PLATFORM == 'opal' # # To include code only on the server, use: # unless RUBY_PLATFORM == 'opal' # ^^ this will not send compile in code in the conditional to the client. # ^^ ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt.rb
lib/volt.rb
require 'volt/volt/environment' require 'volt/extra_core/extra_core' require 'volt/reactive/computation' require 'volt/reactive/dependency' require 'volt/utils/modes' require 'volt/utils/volt_user_error' require 'volt/utils/boolean_patch' require 'volt/utils/time_patch' require 'volt/utils/time_opal_patch' if RUBY_PLAT...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/version.rb
lib/volt/version.rb
module Volt module Version STRING = '0.9.7.pre1' end end
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models.rb
lib/volt/models.rb
require 'volt/extra_core/extra_core' require 'volt/models/model' require 'volt/models/cursor' require 'volt/models/persistors/store_factory' require 'volt/models/persistors/page' require 'volt/models/persistors/array_store' require 'volt/models/persistors/model_store' require 'volt/models/persistors/params' require 'vo...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/cli.rb
lib/volt/cli.rb
# Load in the gemfile require 'bundler/setup' require 'thor' require 'volt/extra_core/extra_core' require 'volt/cli/generators' require 'volt/cli/generate' require 'volt/cli/destroy' require 'volt/version' require 'volt/cli/bundle' module Volt class CLI < Thor include Thor::Actions include Volt::Bundle ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/config.rb
lib/volt/config.rb
# Config lets a user set global config options for Volt. # The hash is setup on the server, then the settings under .public are passed # to the client on initial page render. Volt.configure can be called multiple # times and settings will be added to the existing configuration. if RUBY_PLATFORM == 'opal' require 'os...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/server.rb
lib/volt/server.rb
ENV['SERVER'] = 'true' require 'opal' require 'rack' require 'sass' require 'volt/utils/tilt_patch' require 'volt' require 'volt/tasks/dispatcher' require 'volt/tasks/task' require 'volt/server/rack/component_code' require 'volt/server/template_handlers/sprockets_component_handler' require 'volt/server/websocket/we...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/boot.rb
lib/volt/boot.rb
unless RUBY_PLATFORM == 'opal' # An option to skip requiring. unless ENV['SKIP_BUNDLER_REQUIRE'] # Require in gems Bundler.require(:default, (ENV['VOLT_ENV'] || ENV['RACK_ENV'] || :development).to_sym) end end require 'volt/models' require 'volt/server/rack/component_paths' if RUBY_PLATFORM == 'opal' ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/tasks/task.rb
lib/volt/tasks/task.rb
require 'volt/controllers/collection_helpers' require 'volt/controllers/login_as_helper' module Volt class Task if RUBY_PLATFORM == 'opal' # On the front-end we setup a proxy class to the backend that returns # promises for all calls. def self.method_missing(name, *args, &block) # Meta ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/tasks/dispatcher.rb
lib/volt/tasks/dispatcher.rb
# require 'ruby-prof' require 'volt/utils/logging/task_logger' require 'drb' require 'concurrent' require 'timeout' module Volt # The task dispatcher is responsible for taking incoming messages # from the socket channel and dispatching them to the proper handler. class Dispatcher # When we pass the dispatche...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/data_stores/base_adaptor_server.rb
lib/volt/data_stores/base_adaptor_server.rb
module Volt class DataStore class BaseAdaptorServer end end end
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/data_stores/base_adaptor_client.rb
lib/volt/data_stores/base_adaptor_client.rb
module Volt class DataStore class BaseAdaptorClient # normalize_query should take all parts of the query and return a # "normalized" version, so that two queries that are eseitnally the same # except for things like order are the same. # # Typically this means sorting parts of the qu...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/data_stores/data_store.rb
lib/volt/data_stores/data_store.rb
require 'volt/data_stores/base_adaptor_server' module Volt class DataStore def self.fetch # Cache the driver return @adaptor if @adaptor database_name = Volt.config.db_driver adaptor_name = database_name.camelize + 'AdaptorServer' root = Volt::DataStore if root.const_defined...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/helpers/time.rb
lib/volt/helpers/time.rb
require 'time' require 'date' require 'volt/helpers/time/volt_time' require 'volt/helpers/time/local_volt_time' if RUBY_PLATFORM == 'opal' require 'volt/helpers/time/calculations' require 'volt/helpers/time/local_calculations' if RUBY_PLATFORM == 'opal' require 'volt/helpers/time/duration' require 'volt/helpers/time/nu...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/helpers/time/local_volt_time.rb
lib/volt/helpers/time/local_volt_time.rb
class VoltTime # Returns a string representation of the local time def local_to_s @time.getlocal.to_s end # Returns a canonical representation of the local time def local_asctime @time.getlocal.asctime end # Returns a canonical representation of the local time def local_ctime @time.ge...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/helpers/time/distance.rb
lib/volt/helpers/time/distance.rb
module Volt class Duration UNIT_MAP = { :years => 31536000, :months => 2592000, :weeks => 604800, :days => 86400, :hours => 3600, :minutes => 60, :seconds => 1 } # Returns a string representation of the duration. # # @param How many places in time units t...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/helpers/time/duration.rb
lib/volt/helpers/time/duration.rb
# Much of this class was borrowed from ActiveSupport: # https://github.com/rails/rails/blob/master/activesupport/lib/active_support/duration.rb module Volt class Duration attr_accessor :value, :parts def initialize(value, parts) @value, @parts = value, parts end # Compares with the value on a...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/helpers/time/local_calculations.rb
lib/volt/helpers/time/local_calculations.rb
# Local calculations for use on the client only class VoltTime def change_local(options) t = @time.getlocal new_year = options.fetch(:year, t.year) new_month = options.fetch(:month, t.month) new_day = options.fetch(:day, t.day) new_hour = options.fetch(:hour, t.hour) new_min = options...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/helpers/time/calculations.rb
lib/volt/helpers/time/calculations.rb
# Much of this class was borrowed from ActiveSupport: # https://github.com/rails/rails/blob/ca9736e78ca9348e785a5c78c8cc085c0c2d4731/activesupport/lib/active_support/core_ext/time/calculations.rb class VoltTime COMMON_YEAR_DAYS_IN_MONTH = [nil, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] class << self ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/helpers/time/volt_time.rb
lib/volt/helpers/time/volt_time.rb
# Volt needs its own date/time class because of the differences between # how Opal (i.e. JavaScript) and Ruby handle timezones. In JavaScript # there are only two possible timezones, the local zone and UTC, while # in Ruby any timezone can be set. # VoltTime is always stored in UTC but can be converted to the local tim...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/helpers/time/numeric.rb
lib/volt/helpers/time/numeric.rb
# Much of this class was borrowed from ActiveSupport: # https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/numeric/time.rb # and # https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/integer/time.rb require 'volt/helpers/time/duration' class Numeric ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/benchmark/benchmark.rb
lib/volt/benchmark/benchmark.rb
if RUBY_PLATFORM == 'opal' class Benchmark def self.bm(iterations = 1) puts 'BM' times = [] total_time = nil result = nil iterations.times do start_time = `Date.now()` result = yield end_time = `Date.now()` total_time = `end_time - start_time` ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/controllers/http_controller.rb
lib/volt/controllers/http_controller.rb
require 'volt/server/rack/http_response_header' require 'volt/server/rack/http_response_renderer' require 'volt/controllers/http_controller/http_cookie_persistor' require 'volt/controllers/login_as_helper' require 'volt/utils/lifecycle_callbacks' module Volt # Allow you to create controllers that act as http endpoin...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/controllers/collection_helpers.rb
lib/volt/controllers/collection_helpers.rb
# Collection helpers provide methods to access methods of page directly. # @page is expected to be defined and a Volt::Page module Volt module CollectionHelpers def url Volt.current_app.url end def url_for(params) Volt.current_app.url.url_for(params) end def url_with(params) Vo...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/controllers/model_controller.rb
lib/volt/controllers/model_controller.rb
require 'volt/reactive/reactive_accessors' require 'volt/utils/lifecycle_callbacks' require 'volt/controllers/template_helpers' require 'volt/controllers/collection_helpers' module Volt class ModelController include ReactiveAccessors include LifecycleCallbacks include CollectionHelpers # A model con...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/controllers/login_as_helper.rb
lib/volt/controllers/login_as_helper.rb
module Volt module LoginAsHelper def login_as(user) unless user.is_a?(Volt::User) raise "login_as must be passed a user instance, you passed a #{user.class.to_s}" end # Assign the user_id cookie to the signature for the user id cookies._user_id = Volt.user_login_signature(user) ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/controllers/template_helpers.rb
lib/volt/controllers/template_helpers.rb
module Volt module TemplateHelpders module ClassMethods def template(name, template, bindings) @templates[name] = { 'html' => template, 'bindings' => bindings } end end def self.included(base) # Setup blank templates class variable base.class_attribute :__templates b...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/controllers/http_controller/http_cookie_persistor.rb
lib/volt/controllers/http_controller/http_cookie_persistor.rb
require 'volt/models/persistors/base' module Volt module Persistors class HttpCookiePersistor < Base attr_reader :changed_cookies def initialize(*args) super @changed_cookies = {} end def changed(attribute_name) value = @model.get(attribute_name) value =...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/model_hash_behaviour.rb
lib/volt/models/model_hash_behaviour.rb
module Volt # Contains all of the methods on a model that make it behave like a hash. # Moving this into a module cleans up the main Model class for things that # make it behave like a model. module ModelHashBehaviour def delete(name) name = name.to_sym value = @attributes.delete(name) @...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/state_manager.rb
lib/volt/models/state_manager.rb
module Volt module StateManager def state_for(state_name) ivar_name = :"@#{state_name}" # Depend on the dep state_dep_for(state_name).depend instance_variable_get(ivar_name) end # Called from the QueryListener when the data is loaded def change_state_to(state_name, new_state...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/errors.rb
lib/volt/models/errors.rb
require 'volt/reactive/reactive_hash' module Volt class Errors < ReactiveHash def add(field, error) field_errors = (self[field] ||= []) field_errors << error unless field_errors.include?(error) end # Merge another set of errors in def merge!(errors) if errors errors.each_pa...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/cursor.rb
lib/volt/models/cursor.rb
require 'volt/models/array_model' module Volt class Cursor < ArrayModel end end
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/model_wrapper.rb
lib/volt/models/model_wrapper.rb
module Volt module ModelWrapper # For cretain values, we wrap them to make the behave as a # model. def wrap_value(value, lookup) if value.is_a?(Array) new_array_model(value, @options.merge(parent: self, path: path + lookup)) elsif value.is_a?(Hash) new_model(value, @options.me...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/location.rb
lib/volt/models/location.rb
module Volt class Location def host if RUBY_PLATFORM == 'opal' `document.location.host` else Volt.config.domain end end def protocol scheme + ':' end def scheme if RUBY_PLATFORM == 'opal' `document.location.protocol`[0..-2] else ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/url.rb
lib/volt/models/url.rb
# The url class handles parsing and updating the url require 'volt/reactive/reactive_accessors' require 'volt/models/location' require 'volt/utils/parsing' module Volt class URL include ReactiveAccessors # TODO: we need to make it so change events only trigger on changes reactive_accessor :scheme, :host...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/permissions.rb
lib/volt/models/permissions.rb
module Volt class Model # The permissions module provides helpers for working with Volt permissions. module Permissions module ClassMethods # Own by user requires a logged in user (Volt.current_user) to save a model. If # the user is not logged in, an validation error will occur. Once ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/associations.rb
lib/volt/models/associations.rb
module Volt module Associations module ClassMethods def belongs_to(method_name, options = {}) collection ||= options.fetch(:collection, method_name).pluralize foreign_key ||= options.fetch(:foreign_key, :id) local_key ||= options.fetch(:local_key, "#{method_name}_id") # A...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/field_helpers.rb
lib/volt/models/field_helpers.rb
# Provides a method to setup a field on a model. module Volt module FieldHelpers class InvalidFieldClass < RuntimeError; end NUMERIC_CAST = lambda do |convert_method, val| begin orig = val val = send(convert_method, val) if RUBY_PLATFORM == 'opal' # Opal has a bug in...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/model.rb
lib/volt/models/model.rb
require 'volt/models/model_wrapper' require 'volt/models/array_model' require 'volt/models/helpers/base' require 'volt/models/model_hash_behaviour' require 'volt/models/validations/validations' require 'volt/utils/modes' require 'volt/models/state_manager' require 'volt/models/helpers/model' require 'volt/models/buffer...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/array_model.rb
lib/volt/models/array_model.rb
require 'volt/reactive/reactive_array' require 'volt/models/model_wrapper' require 'volt/models/helpers/base' require 'volt/models/state_manager' require 'volt/models/helpers/array_model' require 'volt/data_stores/data_store' module Volt class RecordNotFoundException < Exception ; end class ArrayModel < ReactiveA...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/buffer.rb
lib/volt/models/buffer.rb
require 'volt/reactive/reactive_accessors' module Volt module Buffer # Save saves the contents of a buffer to the save_to location. If the buffer is new, it will create a new # model to save to. Otherwise it will be an existing model. Save returns a promise that may fail with # validation errors from ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/helpers/change_helpers.rb
lib/volt/models/helpers/change_helpers.rb
# ModelChangeHelpers handle validating and persisting the data in a model # when it is changed. #run_changed will be called from the model. module Volt module Models module Helpers module ChangeHelpers def self.included(base) base.setup_action_helpers_in_class(:before_save, :before_valida...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/helpers/base.rb
lib/volt/models/helpers/base.rb
module Volt module Models module Helpers # A place for things shared between an ArrayModel and a Model module Base def deep_unwrap(value) if value.is_a?(Model) value.to_h elsif value.is_a?(ArrayModel) value.to_a else value ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/helpers/listener_tracker.rb
lib/volt/models/helpers/listener_tracker.rb
module Volt module Models module Helpers # Included in model's so they can inform the ArrayModel when new listeners are added or removed. module ListenerTracker # Called when data from this model begins being watched def listener_added @listener_count ||= 0 @listene...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/helpers/model.rb
lib/volt/models/helpers/model.rb
module Volt module Models module Helpers module Model def saved_state state_for(:saved_state) || :saved end def saved? saved_state == :saved end end end end end
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/helpers/array_model.rb
lib/volt/models/helpers/array_model.rb
module Volt module Models module Helpers module ArrayModel def loaded_state state_for(:loaded_state) end def loaded? loaded_state == :loaded end end end end end
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/helpers/dirty.rb
lib/volt/models/helpers/dirty.rb
module Volt module Models module Helpers # The dirty module provides helper methods for working with and tracking # previous values on model attributes. module Dirty # Return the list of attributes that have changed since the last 'save' event. def changed_attributes @c...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/validators/type_validator.rb
lib/volt/models/validators/type_validator.rb
# Enforces a type on a field. Typically setup from ```field :name, Type``` module Volt # Volt::Boolean can be used if you want a boolean type class Boolean end class TypeValidator def self.validate(model, field_name, args) errors = {} value = model.get(field_name) type_restriction = ar...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/validators/unique_validator.rb
lib/volt/models/validators/unique_validator.rb
module Volt class UniqueValidator def self.validate(model, field_name, args) if RUBY_PLATFORM != 'opal' if args value = model.get(field_name) query = {} # Check to see if any other documents have this value. query[field_name.to_s] = value query['id...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/validators/phone_number_validator.rb
lib/volt/models/validators/phone_number_validator.rb
module Volt class PhoneNumberValidator < FormatValidator DEFAULT_OPTIONS = { with: /^(\+?\d{1,2}[\.\-\ ]?\d{3}|\(\d{3}\)|\d{3})[\.\-\ ]?\d{3,4}[\.\-\ ]?\d{4}$/, message: 'must be a phone number with area or country code' } private def default_options DEFAULT_OPTIONS end end e...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/validators/format_validator.rb
lib/volt/models/validators/format_validator.rb
module Volt # Validates the format of a field against any number of block or regex # criteria class FormatValidator # Creates a new instance with the provided options and returns it's errors # # @example # options = { with: /.+@.+/, message: 'must include an @ symobl' } # # FormatValid...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/validators/presence_validator.rb
lib/volt/models/validators/presence_validator.rb
module Volt class PresenceValidator def self.validate(model, field_name, args) errors = {} value = model.get(field_name) if !value || value.blank? if args.is_a?(Hash) && args[:message] message = args[:message] else message = 'must be specified' end ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/validators/numericality_validator.rb
lib/volt/models/validators/numericality_validator.rb
module Volt class NumericalityValidator def self.validate(model, field_name, args) # Construct the class and return the errors new(model, field_name, args).errors end attr_reader :errors def initialize(model, field_name, args) @field_name = field_name @args = args @erro...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/validators/email_validator.rb
lib/volt/models/validators/email_validator.rb
module Volt class EmailValidator < FormatValidator DEFAULT_OPTIONS = { with: /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i, message: 'must be an email address' } private def default_options DEFAULT_OPTIONS end end end
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/validators/inclusion_validator.rb
lib/volt/models/validators/inclusion_validator.rb
module Volt class InclusionValidator def self.validate(model, field_name, args) errors = {} value = model.get(field_name) if args.is_a?(Array) list = args message = nil elsif args.is_a?(Hash) list = args[:in] message = args[:message] fail 'A list t...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/validators/length_validator.rb
lib/volt/models/validators/length_validator.rb
module Volt class LengthValidator def self.validate(model, field_name, args) errors = {} value = model.get(field_name) if args.is_a?(Fixnum) min = args max = nil message = nil elsif args.is_a?(Hash) min = args[:length] || args[:minimum] max...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/validators/user_validation.rb
lib/volt/models/validators/user_validation.rb
module Volt # Provide methods on the model class to more easily setup user validations module UserValidatorHelpers end end
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/flash.rb
lib/volt/models/persistors/flash.rb
require 'volt/models/persistors/base' module Volt module Persistors class Flash < Base def added(model, index) if Volt.client? # Setup a new timer for clearing the flash. ` setTimeout(function() { self.$clear_model(model); }, 5000); ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/cookies.rb
lib/volt/models/persistors/cookies.rb
# Use a volt model to persist to cookies. # Some code borrowed from: https://github.com/opal/opal-browser/blob/master/opal/browser/cookies.rb require 'volt/models/persistors/base' module Volt module Persistors # Backs a collection in the local store class Cookies < Base def read_cookies cookie...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/model_identity_map.rb
lib/volt/models/persistors/model_identity_map.rb
require 'volt/utils/generic_counting_pool' module Volt # The identity map ensures that there is only one copy of a model # used on the front end at a time. class ModelIdentityMap < GenericCountingPool # add extends GenericCountingPool so it can add in a model without # a direct lookup. We use this when ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/array_store.rb
lib/volt/models/persistors/array_store.rb
require 'volt/models/persistors/store' require 'volt/models/persistors/store_state' require 'volt/models/persistors/query/query_listener_pool' require 'volt/utils/timers' module Volt module Persistors class ArrayStore < Store include StoreState @@query_pool = QueryListenerPool.new attr_reade...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/page.rb
lib/volt/models/persistors/page.rb
require 'volt/models/persistors/base' module Volt module Persistors class Page < Base def auto_generate_id true end def where(query) @model.select do |model| # Run through each key in the query and make sure the value matches. # We use .all? because once one...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/store.rb
lib/volt/models/persistors/store.rb
require 'volt/models/persistors/base' require 'volt/models/persistors/model_identity_map' module Volt module Persistors class Store < Base @@identity_map = ModelIdentityMap.new def initialize(model, tasks = nil) @tasks = tasks @model = model @saved = false end d...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/params.rb
lib/volt/models/persistors/params.rb
require 'volt/models/persistors/base' module Volt module Persistors class Params < Base def changed(attribute_name) if RUBY_PLATFORM == 'opal' ` if (window.setTimeout && this.$run_update.bind) { if (window.paramsUpdateTimer) { clearTimeout(window....
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/base.rb
lib/volt/models/persistors/base.rb
module Volt module Persistors # Implements the base persistor functionality. class Base def initialize(model) @model = model end def loaded(initial_state = nil) @model.change_state_to(:loaded_state, initial_state || :loaded) end # Method that is called when data...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/model_store.rb
lib/volt/models/persistors/model_store.rb
require 'volt/models/persistors/store' require 'volt/models/persistors/store_state' module Volt module Persistors class ModelStore < Store include StoreState attr_reader :model attr_accessor :in_identity_map def initialize(model, tasks) super @in_identity_map = false ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/store_state.rb
lib/volt/models/persistors/store_state.rb
module Volt module Persistors # StoreState provides method for a store to track its loading state. module StoreState # Called when a collection loads def loaded(initial_state = nil) if initial_state @model.change_state_to(:loaded_state, initial_state) elsif !@loaded_state...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/store_factory.rb
lib/volt/models/persistors/store_factory.rb
module Volt module Persistors class StoreFactory def initialize(tasks) @tasks = tasks end def new(model) if model.is_a?(ArrayModel) ArrayStore.new(model, @tasks) else ModelStore.new(model, @tasks) end end end end end
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/local_store.rb
lib/volt/models/persistors/local_store.rb
require 'volt/models/persistors/base' require 'volt/utils/local_storage' require 'volt/utils/ejson' module Volt module Persistors # Backs a collection in the local store class LocalStore < Base # Called when a model is added to the collection def added(model, index) root_model.persistor.s...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/query/normalizer.rb
lib/volt/models/persistors/query/normalizer.rb
module Volt module Query # Normalizes queries so queries that are the same have the same order and parts class Normalizer end end end
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/query/query_listener_pool.rb
lib/volt/models/persistors/query/query_listener_pool.rb
require 'volt/utils/generic_pool' require 'volt/models/persistors/query/query_listener' module Volt # Keeps track of all query listeners, so they can be reused in different # places. Dynamically generated queries may end up producing the same # query in different places. This makes it so we only need to track ...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/persistors/query/query_listener.rb
lib/volt/models/persistors/query/query_listener.rb
module Volt # The query listener is what gets notified on the backend when the results from # a query have changed. It then will make the necessary changes to any ArrayStore's # to get them to display the new data. class QueryListener attr_reader :listening def initialize(query_listener_pool, tasks, c...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/validations/errors.rb
lib/volt/models/validations/errors.rb
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/validations/validations.rb
lib/volt/models/validations/validations.rb
require 'volt/models/errors' require 'volt/models/validators/format_validator' require 'volt/models/validators/email_validator' require 'volt/models/validators/inclusion_validator' require 'volt/models/validators/length_validator' require 'volt/models/validators/numericality_validator' require 'volt/models/validators/p...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/root_models/store_root.rb
lib/volt/models/root_models/store_root.rb
# StoreRoot should already be setup when this class is already loaded. It is a # Volt::Model that is loaded as the base class for the root of store. # # In order to support setting properties directly on store, we create a table # called "root_store_models", and create a single require 'volt/models/root_models/root_m...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/models/root_models/root_models.rb
lib/volt/models/root_models/root_models.rb
# When you get the root of a collection (.store, .page, etc...), it gives you # back a unique class depending on the collection. This allows you to add # things to the root easily. # # The name of the model will be {CollectionName}Root. All root model classes # inherit from BaseRootModel, which provides methods to ac...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/generic_pool.rb
lib/volt/utils/generic_pool.rb
module Volt # GenericPool is a base class you can inherit from to cache items # based on a lookup. # # GenericPool assumes either a block is passed to lookup, or a # #create method, that takes the path arguments and reutrns a new instance. # # GenericPool can handle as deep of paths as needed. You can al...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/tilt_patch.rb
lib/volt/utils/tilt_patch.rb
class Tilt::Template # Tilt outputs the following error: # WARN: tilt autoloading 'sass' in a non thread-safe way; explicit require 'sass' suggested. # I can't get rid of this no matter what I do. (If someone smarter wants to take a shot at # it, please do.) For now for my sanity, I'm just silencing its warni...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/lifecycle_callbacks.rb
lib/volt/utils/lifecycle_callbacks.rb
# The Actions module adds helpers for setting up and using # actions on a class. You can setup helpers for an action with # # setup_action_helpers_in_class(:before_action, :after_action) # # The above will setup before_action and after_action methods on # the class. Typically setup_action_helpers_in_class will be r...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/ejson.rb
lib/volt/utils/ejson.rb
require 'json' # We auto require time on the server, so we can decode VoltTime's in the parent # process on the ForkingServer. (Since no user code is booted in the forking # server). On the client the user has to require it if they want to use it. unless RUBY_PLATFORM == 'opal' require 'volt/helpers/time' end mod...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/csso_patch.rb
lib/volt/utils/csso_patch.rb
# CSSO complains when using node as an execJS runtime, but we currently have # to due to a bug in therubyracer (or maybe execJS?) require 'execjs' module Csso class JsLib def initialize spec = Gem::Specification.find_by_name("csso-rails") path = spec.gem_dir lib = File.read(File.expand_path(...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/promise_extensions.rb
lib/volt/utils/promise_extensions.rb
# A temp patch for promises until https://github.com/opal/opal/pull/725 is released. class Promise class UnrealizedPromiseException < RuntimeError ; end # We made a choice not to support comparitors and << and >> on method_missing # on Promises. This makes it easier to understand what promise proxying does # a...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false
voltrb/volt
https://github.com/voltrb/volt/blob/f942b92385adbc894ee4a37903ee6a9c1a65e9a4/lib/volt/utils/modes.rb
lib/volt/utils/modes.rb
require 'thread' if RUBY_PLATFORM == 'opal' # Stub thread class class Thread def self.current @current ||= {} end end end module Volt # Modes provide a way to effect the state inside of a block that # can be checked from elsewhere. This is very useful if you have # some flag you may want to...
ruby
MIT
f942b92385adbc894ee4a37903ee6a9c1a65e9a4
2026-01-04T15:51:19.582691Z
false