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
debugtalk/AppiumBooster
https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/helpers/simulator_helper.rb
lib/helpers/simulator_helper.rb
# filename: lib/helpers/simulator_helper.rb def get_device_type_id device_type # device_type format: e.g. iPhone 5s device_types_output = `xcrun simctl list devicetypes` device_type_ids = device_types_output.scan /#{device_type} \((.*)\)/ device_type_ids[0][0] end def get_runtime_id runtime # runtime format...
ruby
MIT
808b04ea0ec046b6cf59f8b0b07e195764eb58c0
2026-01-04T17:42:57.924826Z
false
debugtalk/AppiumBooster
https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/helpers/exceptions.rb
lib/helpers/exceptions.rb
ruby
MIT
808b04ea0ec046b6cf59f8b0b07e195764eb58c0
2026-01-04T17:42:57.924826Z
false
debugtalk/AppiumBooster
https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/helpers/yaml_helper.rb
lib/helpers/yaml_helper.rb
# filename: lib/helpers/yaml_helper.rb require 'yaml' def load_steps_lib """ load yaml format steps library. output steps_lib_hash format: { 'AccountSteps': { 'enter My Account page': { 'control_id': 'btnMenuMyAccount', 'control_action': 'click', 'expectation': 'tablecellMyAccoun...
ruby
MIT
808b04ea0ec046b6cf59f8b0b07e195764eb58c0
2026-01-04T17:42:57.924826Z
false
debugtalk/AppiumBooster
https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/helpers/env_helper.rb
lib/helpers/env_helper.rb
# filename: lib/helpers/env_helper.rb def initialize_project_environment(options) output_folder = options[:output_folder] unless File.exists?(output_folder) Dir.mkdir(output_folder) end time = Time.now.strftime "%Y-%m-%d_%H:%M:%S" results_dir = File.expand_path(File.join(output_folder, "#{time}")) un...
ruby
MIT
808b04ea0ec046b6cf59f8b0b07e195764eb58c0
2026-01-04T17:42:57.924826Z
false
debugtalk/AppiumBooster
https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/helpers/utils.rb
lib/helpers/utils.rb
# filename: lib/helpers/util.rb def eval_expression(str) """ evaluate ruby expression e.g. ${Time.now.to_i}@debugtalk.com => 1471318368@debugtalk.com """ if str && str.class == String str_copy = str.dup str_copy.gsub!(/\$\{(.*?)\}/) do eval($1) end return str_copy end str end
ruby
MIT
808b04ea0ec046b6cf59f8b0b07e195764eb58c0
2026-01-04T17:42:57.924826Z
false
debugtalk/AppiumBooster
https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/helpers/config_helper.rb
lib/helpers/config_helper.rb
# filename: lib/helpers/config_helper.rb require 'yaml' class Hash def method_missing(method, *opts) self[method.to_s] || super end end module Kernel def config YAML.load_file File.join(Dir.pwd, 'config.yml') end end
ruby
MIT
808b04ea0ec046b6cf59f8b0b07e195764eb58c0
2026-01-04T17:42:57.924826Z
false
debugtalk/AppiumBooster
https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/helpers/driver_helper.rb
lib/helpers/driver_helper.rb
# filename: lib/helpers/driver_helper.rb require 'appium_lib' require 'fileutils' class AppiumDriver def initialize(options) $LOG.info "initialize AppiumDriver ...".green @app_type = options[:app_type] @results_dir = options[:results_dir] @screenshots_dir = options[:screenshots_dir] @xmls_dir =...
ruby
MIT
808b04ea0ec046b6cf59f8b0b07e195764eb58c0
2026-01-04T17:42:57.924826Z
false
debugtalk/AppiumBooster
https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/helpers/converter_helper.rb
lib/helpers/converter_helper.rb
# filename: lib/helpers/converter_helper.rb require_relative 'yaml_helper' def convert_yaml_to_csv(testcase_yaml_file_path) $LOG.info "Convert #{testcase_yaml_file_path} to CSV format test testcases.".green testcase_hash = load_testcase_yaml_file(testcase_yaml_file_path) features_suite = testcase_hash['features...
ruby
MIT
808b04ea0ec046b6cf59f8b0b07e195764eb58c0
2026-01-04T17:42:57.924826Z
false
debugtalk/AppiumBooster
https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/helpers/colorize.rb
lib/helpers/colorize.rb
# filename: lib/helpers/colorize.rb class String # colorization def colorize(color_code) if (defined? OUTPUT_WITH_COLOR) && (not OUTPUT_WITH_COLOR) self else "\e[#{color_code}m#{self}\e[0m" end end def black colorize(30) end def red colorize(31) end def green colo...
ruby
MIT
808b04ea0ec046b6cf59f8b0b07e195764eb58c0
2026-01-04T17:42:57.924826Z
false
debugtalk/AppiumBooster
https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/pages/actions.rb
lib/pages/actions.rb
# filename: lib/pages/actions.rb module Pages module Actions def send_keys(text) wait { @found_element.send_keys text } end def _type(text) wait { @found_element.type text } end def type(text) begin _type(text) rescue Selenium::WebDriver::Error::UnknownError => ...
ruby
MIT
808b04ea0ec046b6cf59f8b0b07e195764eb58c0
2026-01-04T17:42:57.924826Z
false
debugtalk/AppiumBooster
https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/pages/control.rb
lib/pages/control.rb
# filename: lib/pages/control.rb require_relative 'actions' module Pages module Control class << self include Pages::Actions def specify(control_id) @found_element = wait { id control_id } self end end end # module Control end # module Pages module Kernel def contro...
ruby
MIT
808b04ea0ec046b6cf59f8b0b07e195764eb58c0
2026-01-04T17:42:57.924826Z
false
debugtalk/AppiumBooster
https://github.com/debugtalk/AppiumBooster/blob/808b04ea0ec046b6cf59f8b0b07e195764eb58c0/lib/pages/inner_screen.rb
lib/pages/inner_screen.rb
# filename: lib/pages/inner_screen.rb module Pages module InnerScreen class << self def should_have_text(text) wait { text_exact text } end def should_have_button(name) wait { button_exact name } end def should_have_class(name) wait { tag name } end ...
ruby
MIT
808b04ea0ec046b6cf59f8b0b07e195764eb58c0
2026-01-04T17:42:57.924826Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/test/context_test.rb
test/context_test.rb
require "test_helper" module Hyalite class ContextTest < Opal::Test::Unit::TestCase include ::RenderingHelper test 'context value should render as text' do class ParentComonent include Hyalite::Component def child_context { text: 'Star ship' } end def render...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/test/props_test.rb
test/props_test.rb
require "test_helper" module Hyalite class PropsTest < Opal::Test::Unit::TestCase include RenderingHelper test 'text prop' do class WithProps include Hyalite::Component def render Hyalite.create_element('div', {className: 'actual'}, @props[:text]) end end ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/test/test_helper.rb
test/test_helper.rb
require 'hyalite' require 'native' require "opal/test-unit" module RenderingHelper attr_accessor :mount_at def self.included(mod) mod.setup do $document.body.clear mount_at = Hyalite::DOM::Element.create('div').add_class('root') $document.body << mount_at end end def render(&block) ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/test/render_test.rb
test/render_test.rb
require "test_helper" module Hyalite class RenderTest < Opal::Test::Unit::TestCase include RenderingHelper test 'rendering plain div element' do render do Hyalite.create_element('div', {className: 'actual'}) end assert_kind_of(Hyalite::DOM::Element, $document['.actual'].first) ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/test/state_test.rb
test/state_test.rb
require "test_helper" module Hyalite class StateTest < Opal::Test::Unit::TestCase include RenderingHelper test 'DSL' do class StateDefinition include Hyalite::Component state :test, '' def update_state @state.test = 'test' end def render H...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/test/dom_property_test.rb
test/dom_property_test.rb
require "test_helper" module Hyalite class DOMPropertyTest < Opal::Test::Unit::TestCase # DOMProperty#is_custom_attribute test "'data-xxx' is true" do result = Hyalite::DOMProperty.is_custom_attribute('data-xxxx') assert(result) end test "'xxx' is false" do result = Hyalite::DOMPr...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/example/app/application.rb
example/app/application.rb
require 'hyalite' class ExampleView include Hyalite::Component state :count, 0 def component_did_mount interval = Proc.new do @state.count += 1 #set_state :count, @state.count end `setInterval(interval, 5000)` end def render div({class: 'example'}, h2(nil, @props[:title]...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite.rb
lib/hyalite.rb
require 'opal' require 'hyalite/version' module Hyalite end if RUBY_ENGINE == 'opal' require 'hyalite/main' end
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/main.rb
lib/hyalite/main.rb
require 'opal' require 'hyalite/logger' require 'hyalite/transaction' require 'hyalite/adler32' require 'hyalite/mount' require 'hyalite/element' require 'hyalite/dom_component' require 'hyalite/text_component' require 'hyalite/dom' module Hyalite class << self RESERVED_PROPS = [:key, :ref, :children] def c...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/component.rb
lib/hyalite/component.rb
require 'hyalite/short_hand' module Hyalite module Component TAGS = %w( a abbr address area article aside audio b base bdi bdo blockquote body br button button button button canvas caption cite code col colgroup command datalist dd del details dfn div dl dt em embed fieldset figcaption figure footer ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/instance_handles.rb
lib/hyalite/instance_handles.rb
module Hyalite module InstanceHandles @root_index = 0 SEPARATOR = '.' class << self def root_id_string(index) SEPARATOR + index.to_s(36) end def create_root_id root_id_string(root_index); end def root_id_from_node_id(id) if id && id.start_with?(SEP...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/callback_queue.rb
lib/hyalite/callback_queue.rb
class CallbackQueue def initialize @queue = [] end def enqueue(proc = nil, &block) if proc @queue << proc elsif block_given? @queue << block end end def notify_all queue = @queue @queue = [] while queue.length > 0 proc = queue.shift proc.call end end...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/input_wrapper.rb
lib/hyalite/input_wrapper.rb
require 'json' require 'hyalite/linked_value_utils' require 'hyalite/dom_operations' module Hyalite class InputWrapper include LinkedValueUtils def initialize(dom_component) @dom_component = dom_component end def mount_wrapper props = @dom_component.current_element.props @wrapper_...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/element.rb
lib/hyalite/element.rb
module Hyalite class ElementObject attr_reader :type, :key, :ref, :props, :owner attr_accessor :parent def initialize(type, key, ref, owner, props) @type = type @key = key @ref = ref @owner = owner @props = props end def inspect "<#{type} #{props && props.insp...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/version.rb
lib/hyalite/version.rb
module Hyalite VERSION = "0.3.3" end
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/logger.rb
lib/hyalite/logger.rb
module Hyalite module Logger ERROR_LEVELS = %i(error warn info debug) def self.log_level=(level) @log_level_index = ERROR_LEVELS.index(level) end def self.log_level @log_level_index ||= ERROR_LEVELS.index(:warn) ERROR_LEVELS[@log_level_index] end def self.error(obj) ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/update_queue.rb
lib/hyalite/update_queue.rb
module Hyalite class UpdateQueue class << self def is_mounted(public_instance) internal_instance = Hyalite.instance_map[public_instance] if internal_instance !!internal_instance.rendered_component else false end end def enqueue_callback(public...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/synthetic_event.rb
lib/hyalite/synthetic_event.rb
module Hyalite class SyntheticEvent attr_reader :event def initialize(event) @event = event @listeners = [] end def add_listener(listener, target_id) @listeners << [listener, target_id] end def each_listener(&block) @listeners.each {|listener| yield(listener) } e...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/utils.rb
lib/hyalite/utils.rb
module Hyalite ESCAPE_LOOKUP = { '&' => '&amp;', '>' => '&gt;', '<' => '&lt;', '"' => '&quot;', '\'' => '&#x27;', } ESCAPE_REGEX = /[&><"']/ def self.quote_attribute_value_for_browser(text) "\"#{escape_text_content_for_browser(text)}\"" end def self.escape_text_content_for_browser...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/transaction.rb
lib/hyalite/transaction.rb
module TransactionWrapper def init end def close end end class Transaction include TransactionWrapper def initialize(transaction_wrappers = nil, &block) @transaction_wrappers = transaction_wrappers || [] if block_given? @close_proc = block @transaction_wrappers << self end end ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/adler32.rb
lib/hyalite/adler32.rb
module Adler32 MOD = 65521 class << self def calc(*args) a = 1 b = 0 c = 1000 args.each do |str| throw ArgumentError, "Only string can be passed: #{str.inspect}:#{str.class}" unless str.is_a? String str.each_char do |char| a += char.ord b += a ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/linked_value_utils.rb
lib/hyalite/linked_value_utils.rb
module Hyalite module LinkedValueUtils class << self def value(props) if props.has_key? :valueLink props[:valueLink][:value] else props[:value] end end def checked(props) if props.has_key? :checkedLink props[:checkedLink][:value] ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/composite_component.rb
lib/hyalite/composite_component.rb
require 'hyalite/update_queue' require 'hyalite/reconciler' require 'hyalite/internal_component' module Hyalite class CompositeComponent include InternalComponent attr_reader :current_element, :rendered_component attr_accessor :top_level_wrapper, :pending_state_queue, :mount_order, :pending_callbacks, :...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/internal_component.rb
lib/hyalite/internal_component.rb
module Hyalite module InternalComponent attr_accessor :mount_index def mount_component(root_id, mount_ready, context) end def recieve_component(next_element, mount_ready) end end end
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom_operations.rb
lib/hyalite/dom_operations.rb
require 'hyalite/dom_property_operations' module Hyalite module DOMOperations class << self def update_property_by_id(id, name, value) node = Mount.node(id) if value DOMPropertyOperations.set_value_for_property(node, name, value) else DOMPropertyOperations.delet...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/try.rb
lib/hyalite/try.rb
class Object def try unless self.nil? yield self end end end
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/reconcile_transaction.rb
lib/hyalite/reconcile_transaction.rb
require 'hyalite/transaction' require 'hyalite/browser_event' module Hyalite class ReconcileTransaction < Transaction def initialize @mount_ready_wrapper = MountReadyWrapper.new super [ @mount_ready_wrapper, EventSuppressionWrapper.new ] end def mount_ready @mount_ready_wrapper.queue ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/text_component.rb
lib/hyalite/text_component.rb
require 'hyalite/internal_component' module Hyalite class TextComponent include InternalComponent def initialize(text) @text = text end def current_element @text end def mount_component(root_id, mount_ready, context) @root_node_id = root_id @native_node = $document....
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/proxy_component.rb
lib/hyalite/proxy_component.rb
class ProxyComponent include Component include Component::ShortHand def self.render_proc=(proc) @render_proc = proc end def self.render_proc @render_proc end def render self.instance_exec(@props, &self.class.render_proc) end end
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/updates.rb
lib/hyalite/updates.rb
require 'hyalite/transaction' require 'hyalite/callback_queue' require 'hyalite/reconciler' require 'hyalite/reconcile_transaction' module Hyalite class Updates class NestedUpdate include TransactionWrapper def initialize(dirty_components) @dirty_components = dirty_components end ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/mount.rb
lib/hyalite/mount.rb
require 'hyalite/transaction' require 'hyalite/adler32' require 'hyalite/try' require 'hyalite/transaction' require 'hyalite/element' require 'hyalite/component' require 'hyalite/instance_handles' require 'hyalite/updates' require 'hyalite/composite_component' module Hyalite module Mount ID_ATTR_NAME = 'data-hya...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/event_dispatcher.rb
lib/hyalite/event_dispatcher.rb
module Hyalite class EventDispatcher def initialize(&extract_events) @enabled = true @listener_bank = {} @extract_events = extract_events @event_queue = [] end def enabled? @enabled end def enabled=(enabled) @enabled = enabled end def trap_bubbled_eve...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/browser_event.rb
lib/hyalite/browser_event.rb
require 'set' require 'hyalite/event_dispatcher' require 'hyalite/synthetic_event' require 'hyalite/event_plugin/event_plugin_registry' require 'hyalite/event_plugin/simple_event_plugin' require 'hyalite/event_plugin/change_event_plugin' module Hyalite module BrowserEvent TOP_EVENT_MAPPING = { topBlur: 'bl...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/short_hand.rb
lib/hyalite/short_hand.rb
module Hyalite module Component module ShortHand end end end
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/multi_children.rb
lib/hyalite/multi_children.rb
module Hyalite module MultiChildren def mount_children(nested_children, mount_ready, context) children = instantiate_children(nested_children, context) @rendered_children = children index = 0 children.keys.map do |name| child = children[name] root_id = root_node_id + name ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom.rb
lib/hyalite/dom.rb
module Hyalite module DOM end end require 'native' require_relative 'dom/event/mouse_event_interface' require_relative 'dom/event/data_transfer' require_relative 'dom/event/keyboard_event' require_relative 'dom/event/mouse_event' require_relative 'dom/event/drag_event' require_relative 'dom/event/touch_event' requ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom_component.rb
lib/hyalite/dom_component.rb
require 'hyalite/multi_children' require 'hyalite/dom_property_operations' require 'hyalite/internal_component' require 'hyalite/input_wrapper' module Hyalite class DOMComponent include MultiChildren include InternalComponent attr_reader :root_node_id def initialize(element) @element = elemen...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom_property_operations.rb
lib/hyalite/dom_property_operations.rb
require 'hyalite/dom_property' require 'hyalite/utils' module Hyalite module DOMPropertyOperations VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][a-zA-Z_\.\-\d]*$/ class << self def create_markup_for_property(element, name, value) property_info = DOMProperty.property_info(name) if property_i...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom_property.rb
lib/hyalite/dom_property.rb
module Hyalite module DOMProperty ID_ATTRIBUTE_NAME = 'data-hyalite-id' MUST_USE_ATTRIBUTE = 1 MUST_USE_PROPERTY = 2 HAS_BOOLEAN_VALUE = 4 HAS_SIDE_EFFECTS = 8 HAS_NUMERIC_VALUE = 16 HAS_POSITIVE_NUMERIC_VALUE = 32 HAS_OVERLOADE...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/reconciler.rb
lib/hyalite/reconciler.rb
module Hyalite module Reconciler SEPARATOR = '.'; SUBSEPARATOR = ':'; class << self def mount_component(internal_instance, root_id, mount_ready, context) markup = internal_instance.mount_component(root_id, mount_ready, context) if internal_instance.current_element.respond_to?(:ref)...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/event_plugin/change_event_plugin.rb
lib/hyalite/event_plugin/change_event_plugin.rb
module Hyalite class ChangeEventPlugin EVENT_TYPES = { change: { phasedRegistrationNames: { bubbled: "onChange", captured: "onChangeCapture" }, dependencies: [ :topBlur, :topChange, :topClick, :topFocus, :topInput,...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/event_plugin/event_plugin_registry.rb
lib/hyalite/event_plugin/event_plugin_registry.rb
module Hyalite class EventPluginRegistry def initialize(*plugins) @registration_name_modules = {} @registration_name_dependencies = {} @plugins = [] plugins.each {|plugin| add_plugin(plugin) } end def add_plugin(plugin) plugin.event_types.each do |key, dispatch_config| ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/event_plugin/simple_event_plugin.rb
lib/hyalite/event_plugin/simple_event_plugin.rb
module Hyalite class SimpleEventPlugin EVENT_TYPES = { blur: { phasedRegistrationNames: { bubbled: :onBlur, captured: :onBlurCapture } }, click: { phasedRegistrationNames: { bubbled: :onClick, captured: :onClickCapture } ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/collection.rb
lib/hyalite/dom/collection.rb
require_relative 'element' module Hyalite::DOM class Collection include Native include Enumerable def each(&block) `self.native.length`.times do |i| block.call Element.new(`self.native.item(i)`) end nil end def [](index) Element.new(`self.native.item(index)`) ...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/element.rb
lib/hyalite/dom/element.rb
module Hyalite::DOM class Element include Native include Node alias_native :set_attribute, :setAttribute alias_native :get_attribute, :getAttribute alias_native :remove_attribute, :removeAttribute alias_native :tag_name, :tagName native_accessor :value def element? true en...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/event.rb
lib/hyalite/dom/event.rb
module Hyalite module DOM module Event EVENT_CLASSES = { # MouseEvent 'click' => MouseEvent, 'dblclick' => MouseEvent, 'mousedown' => MouseEvent, 'mouseup' => MouseEvent, 'mousemove' => MouseEvent, 'mouseenter' => MouseEvent, 'mouseleave' => Mo...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/text.rb
lib/hyalite/dom/text.rb
module Hyalite::DOM class Text include Native include Node def self.create(text) $document.create_text(text) end def text? true end end end
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/window.rb
lib/hyalite/dom/window.rb
module Hyalite::DOM class Window include Native include EventTarget native_reader :document def location Native(`#@native.location`) end def location=(loc) Native(`#@native.location=loc`) end def width `#@native.innerWidth` end def height `#@native....
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/node.rb
lib/hyalite/dom/node.rb
module Hyalite::DOM module Node include EventTarget attr_reader :native def self.create(node) @classes ||= [nil, Element, nil, Text, nil, nil, nil, nil, nil, Document, nil, nil] if klass = @classes[`node.nodeType`] klass.new(node) else raise ArgumentError, 'cannot inst...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/event_target.rb
lib/hyalite/dom/event_target.rb
module Hyalite::DOM module EventTarget def on(name, &block) callback = Proc.new{|event| block.call(Event.create(event))} `#@native.addEventListener(name, callback)` end end end
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/body.rb
lib/hyalite/dom/body.rb
module Hyalite::DOM class Body include Native include Node end end
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/document.rb
lib/hyalite/dom/document.rb
module Hyalite::DOM class Document include Native include Node def create_element(tag) Element.new `self.native.createElement(tag)` end def create_text(text) Text.new `self.native.createTextNode(text)` end def body Body.new `self.native.body` end def ready(&bl...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/event/drag_event.rb
lib/hyalite/dom/event/drag_event.rb
module Hyalite module DOM module Event class DragEvent include Native include Event include MouseEventInterface def drop_effect `self.native.dataTransfer.dropEffect` end def drop_effect=(effect) `self.native.dataTransfer.dropEffect = effe...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/event/keyboard_event.rb
lib/hyalite/dom/event/keyboard_event.rb
module Hyalite module DOM module Event class KeyboardEvent include Native include Event alias_native :code alias_native :key alias_native :shift_key, :shiftKey alias_native :alt_key, :altKey alias_native :ctrl_key, :ctrlKey alias_native :meta_...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/event/touch_event.rb
lib/hyalite/dom/event/touch_event.rb
module Hyalite module DOM module Event class TouchEvent include Native include Event alias_native :touches alias_native :change_touches, :changeTouches alias_native :target_touches, :targetTouches alias_native :shift_key, :shiftKey alias_native :alt_k...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/event/focus_event.rb
lib/hyalite/dom/event/focus_event.rb
module Hyalite module Dom module Event class FocusEvent include Native include Event def related_target Node.create(`#@native.relatedTarget`) end end end end end
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/event/mouse_event.rb
lib/hyalite/dom/event/mouse_event.rb
module Hyalite module DOM module Event class MouseEvent include Native include Event include MouseEventInterface end end end end
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/event/data_transfer.rb
lib/hyalite/dom/event/data_transfer.rb
module Hyalite module DOM module Event class DataTransfer include Native alias_native :clear, :createData alias_native :drag_image=, :setDragImage native_reader :files native_reader :items native_reader :types def []=(name, value) `self.na...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
youchan/hyalite
https://github.com/youchan/hyalite/blob/8bd491057199d9879230dcc662c5cd93ca9e49a7/lib/hyalite/dom/event/mouse_event_interface.rb
lib/hyalite/dom/event/mouse_event_interface.rb
module Hyalite module DOM module Event class AliasPosition def initialize(native, name) @native = native @name = name end def x name = @name + 'X' `#@native[name]` end def y name = @name + 'Y' `#@native[nam...
ruby
MIT
8bd491057199d9879230dcc662c5cd93ca9e49a7
2026-01-04T17:43:10.749556Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/spec/spec_helper.rb
spec/spec_helper.rb
require 'resource_kit' require 'resource_kit/testing' require 'pry' require 'faraday' RSpec.configure do |config| config.order = :random end
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/spec/integration/resource_actions_spec.rb
spec/integration/resource_actions_spec.rb
require 'spec_helper' class DummyResourceActions < ResourceKit::Resource resources do action :dummy, 'GET /dummy' do handler(200) { |resp| resp.body.upcase } end action :headered, 'GET /headered' do before_request { |req| req.headers['Added-Header'] = self.value } end end def value ...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/spec/lib/resource_kit/action_spec.rb
spec/lib/resource_kit/action_spec.rb
require 'spec_helper' RSpec.describe ResourceKit::Action do subject(:action) { ResourceKit::Action.new(:bunk) } describe '#initialize' do it 'initializes with a name' do instance = ResourceKit::Action.new(:all) expect(instance.name).to eq(:all) end end describe '#verb' do it 'sets the...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/spec/lib/resource_kit/inheritable_attribute_spec.rb
spec/lib/resource_kit/inheritable_attribute_spec.rb
require 'spec_helper' describe ResourceKit::InheritableAttribute do subject do Class.new(Object) do extend ResourceKit::InheritableAttribute inheritable_attr :_resources end end it 'provides a reader with an empty inherited attribute' do expect(subject._resources).to be_nil end it ...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/spec/lib/resource_kit/resource_collection_spec.rb
spec/lib/resource_kit/resource_collection_spec.rb
require 'spec_helper' RSpec.describe ResourceKit::ResourceCollection do subject(:collection) { ResourceKit::ResourceCollection.new } describe '#default_handler' do it 'adds the passed black to a hash of handlers on the resource collection' do handler_block = Proc.new { |b| 'whut whut' } collection...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/spec/lib/resource_kit/endpoint_resolver_spec.rb
spec/lib/resource_kit/endpoint_resolver_spec.rb
require 'spec_helper' RSpec.describe ResourceKit::EndpointResolver do describe '#initialize' do it 'initializes with pieces of a URL' do options = { path: '/users', namespace: '/v2', query_param_keys: ['per_page', 'page'] } instance = ResourceKit::EndpointResolver.new(options) expect(instance....
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/spec/lib/resource_kit/action_invoker_spec.rb
spec/lib/resource_kit/action_invoker_spec.rb
require 'spec_helper' RSpec.describe ResourceKit::ActionInvoker do let(:connection) { Faraday.new { |b| b.adapter :test, stubs } } let(:stubs) do Faraday::Adapter::Test::Stubs.new do |stub| stub.get('/users') { |env| [200, {}, 'all users'] } stub.get('/users/bad_page') { |env| [404, {}, 'not found'...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/spec/lib/resource_kit/status_code_mapper_spec.rb
spec/lib/resource_kit/status_code_mapper_spec.rb
require 'spec_helper' RSpec.describe ResourceKit::StatusCodeMapper do describe '.code_for' do it 'returns the status code for a symbol' do expect(described_class.code_for(:ok)).to eq(200) end end end
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/spec/lib/resource_kit/method_factory_spec.rb
spec/lib/resource_kit/method_factory_spec.rb
require 'spec_helper' RSpec.describe ResourceKit::MethodFactory do let(:collection) { ResourceKit::ResourceCollection.new } let(:klass) { Class.new { attr_accessor :connection } } describe '.construct' do before do collection.action :find collection.action :all end it 'adds the methods ...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/spec/lib/resource_kit/resource_spec.rb
spec/lib/resource_kit/resource_spec.rb
require 'spec_helper' RSpec.describe ResourceKit::Resource do describe '.resources' do subject(:resource) { Class.new(described_class) } it 'returns a resource collection' do expect(resource.resources).to be_kind_of(ResourceKit::ResourceCollection) end it 'yields a resource collection' do ...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/spec/lib/resource_kit/testing/have_action_matchers_spec.rb
spec/lib/resource_kit/testing/have_action_matchers_spec.rb
require 'spec_helper' RSpec.describe ResourceKit::Testing::HaveActionMatchers do describe '#initialize' do it 'initializes with a resource class' do action = :all instance = described_class.new(action) expect(instance.action).to be(action) end end describe '#that_handles' do subjec...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/spec/lib/resource_kit/testing/action_handler_matchers_spec.rb
spec/lib/resource_kit/testing/action_handler_matchers_spec.rb
require 'spec_helper' require 'json' RSpec.describe ResourceKit::Testing::ActionHandlerMatchers do let(:resource_class) { Class.new(ResourceKit::Resource) } subject(:matcher) { described_class.new(:all) } describe '#initialize' do it 'initializes with a resource class' do action = :all instance ...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/examples/httpbin_client.rb
examples/httpbin_client.rb
require 'resource_kit' class HTTPBinResource < ResourceKit::Resource resources do get '/ip' => :ip get '/status/:code' => :status end end conn = Faraday.new(url: 'http://httpbin.org') resource = HTTPBinResource.new(connection: conn) puts resource.ip puts puts resource.status(code: 418)
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/examples/digitalocean_droplets.rb
examples/digitalocean_droplets.rb
require 'kartograph' class Droplet attr_accessor :id, :name, :region, :size, :image end class DropletMapping include Kartograph::DSL kartograph do mapping Droplet root_key plural: 'droplets', singular: 'droplet', scopes: [:read] property :id, scopes: [:read] property :name, scopes: [:read, :cr...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/lib/resource_kit.rb
lib/resource_kit.rb
require 'resource_kit/version' module ResourceKit ALLOWED_VERBS = [:get, :post, :put, :delete, :head, :patch, :options] ActionConnection = Struct.new(:action, :connection) autoload :Resource, 'resource_kit/resource' autoload :ResourceCollection, 'resource_kit/resource_collection' autoload :Action, 'resourc...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/lib/resource_kit/resource.rb
lib/resource_kit/resource.rb
require 'resource_kit/inheritable_attribute' module ResourceKit class Resource extend InheritableAttribute inheritable_attr :_resources attr_reader :connection, :scope def initialize(connection: nil, scope: nil) @connection = connection @scope = scope end def self.resources(&bl...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/lib/resource_kit/version.rb
lib/resource_kit/version.rb
module ResourceKit VERSION = "0.1.8" end
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/lib/resource_kit/inheritable_attribute.rb
lib/resource_kit/inheritable_attribute.rb
module ResourceKit module InheritableAttribute def inheritable_attr(name) instance_eval <<-RUBY def #{name}=(v) @#{name} = v end def #{name} @#{name} ||= InheritableAttribute.inherit(self, :#{name}) end RUBY end def self.inherit(klass, name...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/lib/resource_kit/action_invoker.rb
lib/resource_kit/action_invoker.rb
module ResourceKit class ActionInvoker attr_reader :action, :connection, :args, :options, :resource def initialize(action, resource, *args) @action = action @resource = resource @connection = resource.connection @args = args @options = args.last.kind_of?(Hash) ? args.last : {} ...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/lib/resource_kit/status_code_mapper.rb
lib/resource_kit/status_code_mapper.rb
module ResourceKit class StatusCodeMapper MAP = { continue: 100, switching_protocols: 101, processing: 102, ok: 200, created: 201, accepted: 202, non_authoritative_information: 203, no_content: 204, reset_content: 205, partial_content: 206, multi_s...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/lib/resource_kit/resource_collection.rb
lib/resource_kit/resource_collection.rb
require 'forwardable' module ResourceKit class ResourceCollection extend Forwardable def_delegators :@collection, :find, :<<, :each, :include? def initialize @collection = [] end def action(name, verb_and_path = nil, &block) action = Action.new(name, *parse_verb_and_path(verb_and_pa...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/lib/resource_kit/method_factory.rb
lib/resource_kit/method_factory.rb
module ResourceKit class MethodFactory def self.construct(object, resource_collection, invoker = ActionInvoker) resource_collection.each do |action| if object.method_defined?(action.name) raise ArgumentError, "Action '#{action.name}' is already defined on `#{object}`" end m...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/lib/resource_kit/endpoint_resolver.rb
lib/resource_kit/endpoint_resolver.rb
require 'addressable/uri' module ResourceKit class EndpointResolver attr_reader :path, :query_param_keys def initialize(options = {}) @path = options[:path] @query_param_keys = options[:query_param_keys] || [] end def resolve(values = {}) uri = Addressable::URI.parse(path) n...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/lib/resource_kit/action.rb
lib/resource_kit/action.rb
module ResourceKit class Action attr_reader :name def initialize(name, verb = nil, path = nil) @name = name @verb = (verb && verb.downcase.to_sym) || :get @path = path @query_keys = [] end def verb(v = nil) @verb = v if v @verb end def path(path = nil, &b...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/lib/resource_kit/testing.rb
lib/resource_kit/testing.rb
require 'resource_kit/testing/have_action_matchers' require 'resource_kit/testing/action_handler_matchers' module ResourceKit module Testing def have_action(action) HaveActionMatchers.new(action) end def handle_response(action, &block) ActionHandlerMatchers.new(action) end end end if ...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/lib/resource_kit/testing/action_handler_matchers.rb
lib/resource_kit/testing/action_handler_matchers.rb
require 'ostruct' module ResourceKit module Testing class ActionHandlerMatchers ResponseStub = Class.new(OpenStruct) attr_reader :action, :response_stub, :failure_message def initialize(action) @action = action end def with(options, &block) @response_stub = Respon...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
digitalocean/resource_kit
https://github.com/digitalocean/resource_kit/blob/f065ccff05baa9f273521335b84d3aa74be1f48d/lib/resource_kit/testing/have_action_matchers.rb
lib/resource_kit/testing/have_action_matchers.rb
module ResourceKit module Testing class HaveActionMatchers attr_reader :action, :path, :verb def initialize(action) @action = action @failures = [] end def that_handles(*codes) codes.each do |code| handler_codes << StatusCodeMapper.code_for(code) ...
ruby
MIT
f065ccff05baa9f273521335b84d3aa74be1f48d
2026-01-04T17:43:14.665814Z
false
deb-s3/deb-s3
https://github.com/deb-s3/deb-s3/blob/80f9fba8950992b1d05887ed28df272d7e4b4efa/spec/spec_helper.rb
spec/spec_helper.rb
# -*- encoding : utf-8 -*- require "minitest/autorun" $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require 'deb/s3' def fixture(name) File.expand_path("../fixtures/#{name}", __FILE__) end def create_package(attributes = {}) package = Deb::S3::Package.new attributes.each do |k,v| package.send(...
ruby
MIT
80f9fba8950992b1d05887ed28df272d7e4b4efa
2026-01-04T17:43:13.152566Z
false
deb-s3/deb-s3
https://github.com/deb-s3/deb-s3/blob/80f9fba8950992b1d05887ed28df272d7e4b4efa/spec/deb/s3/lock_spec.rb
spec/deb/s3/lock_spec.rb
# -*- encoding : utf-8 -*- require File.expand_path('../../../spec_helper', __FILE__) require 'deb/s3/lock' require 'minitest/mock' describe Deb::S3::Lock do # describe :locked? do # it 'returns true if lock file exists' do # Deb::S3::Utils.stub :s3_exists?, true do # _(Deb::S3::Lock.locked?("stable")).mus...
ruby
MIT
80f9fba8950992b1d05887ed28df272d7e4b4efa
2026-01-04T17:43:13.152566Z
false