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 |
|---|---|---|---|---|---|---|---|---|
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/proc/methods/to_sexp.rb | lib/sourcify/proc/methods/to_sexp.rb | module Sourcify
module Proc
module Methods #:nodoc:all
module ToSexp
def self.included(base)
base.class_eval do
ref_proc = lambda {}
# Case 1: we already have Proc#to_sexp (eg. provided by ParseTree) available,
# we override it to ensure it handles the... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/proc/methods/to_raw_source.rb | lib/sourcify/proc/methods/to_raw_source.rb | module Sourcify
module Proc
module Methods #:nodoc:all
module ToRawSource
def self.included(base)
base.class_eval do
Sourcify.require_rb('proc', 'parser')
def to_raw_source(opts = {}, &body_matcher)
(@sourcified_parser ||= Parser.new(self)).
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/proc/methods/source_location.rb | lib/sourcify/proc/methods/source_location.rb | module Sourcify
module Proc
module Methods #:nodoc:all
module SourceLocation
def self.included(base)
base.class_eval do
# Case (1): the family of 1.9.* behaves slightly differently for created on
# the fly proc, eg. 1.9.2 does yield meaningful Proc#source_location ... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/proc/methods/to_source.rb | lib/sourcify/proc/methods/to_source.rb | module Sourcify
module Proc
module Methods #:nodoc:all
module ToSource
def self.included(base)
base.class_eval do
ref_proc = lambda {}
# Case 1: the current ruby already implements Proc#to_source,
# we override it to ensure it handles the extra args ..... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/proc/parser/raw_scanner.rb | lib/sourcify/proc/parser/raw_scanner.rb |
# line 1 "/home/ty.archlinux/dev/ty/sourcify/lib/sourcify/proc/parser/raw_scanner.rl"
Sourcify.require_rb('proc', 'parser', 'raw_scanner_extensions')
module Sourcify
module Proc
class Parser
module RawScanner #:nodoc:all
# line 134 "/home/ty.archlinux/dev/ty/sourcify/lib/sourcify/proc/parser/raw_scanner... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | true |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/proc/parser/converter.rb | lib/sourcify/proc/parser/converter.rb | module Sourcify
module Proc
class Parser #:nodoc:all
Sourcify.require_rb('common', 'parser', 'converter')
Converter = Common::Parser::Converter
end
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/proc/parser/scanner.rb | lib/sourcify/proc/parser/scanner.rb | Sourcify.require_rb('proc', 'parser', 'raw_scanner')
module Sourcify
module Proc
class Parser #:nodoc:all
class Scanner
class << self
def process(source_code, opts, &matcher)
results = rscan(source_code.to_s, {
:start_pattern => scan_pattern_hint(opts[:attached_... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/proc/parser/normalizer.rb | lib/sourcify/proc/parser/normalizer.rb | module Sourcify
module Proc
class Parser #:nodoc:all
class Normalizer
class << self
def process(sexp, binding)
@binding = binding
Sexp.from_array(fix_no_arg_method_calls(sexp.to_a))
end
def fix_no_arg_method_calls(array)
return arra... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/proc/parser/source_code.rb | lib/sourcify/proc/parser/source_code.rb | module Sourcify
module Proc
class Parser #:nodoc:all
Sourcify.require_rb('common', 'parser', 'source_code')
SourceCode = Common::Parser::SourceCode
end
end
end
| ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
ngty/sourcify | https://github.com/ngty/sourcify/blob/e55d1f6385d945a5164ed205a8a559704d9cb75d/lib/sourcify/proc/parser/raw_scanner_extensions.rb | lib/sourcify/proc/parser/raw_scanner_extensions.rb | Sourcify.require_rb('common', 'parser', 'raw_scanner', 'extensions')
module Sourcify
module Proc
class Parser
module RawScanner #:nodoc:all
module Extensions
include Common::Parser::RawScanner::Extensions
class DoEndBlockCounter < Common::Parser::RawScanner::Counter; end
... | ruby | MIT | e55d1f6385d945a5164ed205a8a559704d9cb75d | 2026-01-04T17:33:13.791481Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/bin/jmespath.rb | bin/jmespath.rb | #!/usr/bin/env ruby
# frozen_string_literal: true
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'jmespath'
require 'json'
expression = ARGV[0]
json = JSON.parse(STDIN.read)
$stdout.puts(JSON.dump(JMESPath.search(expression, json)))
| ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/spec/compliance_spec.rb | spec/compliance_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'Compliance' do
Dir.glob('spec/{compliance,legacy}/*.json').each do |path|
test_file = File.basename(path).split('.').first
next if test_file == 'benchmarks'
next if ENV['TEST_FILE'] && ENV['TEST_FILE'] != test_file
describe(test_file) do
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/spec/implicit_conversion_spec.rb | spec/implicit_conversion_spec.rb | # frozen_string_literal: true
require 'spec_helper'
module Wrapper
def self.wrap(o)
o.respond_to?(:to_ary) ? Arrayish.new(o) : o.respond_to?(:to_hash) ? Hashish.new(o) : o
end
end
class Arrayish
def initialize(ary)
@ary = ary.to_ary
end
attr_reader :ary
def to_ary
@ary.map { |e| Wrapper.wrap... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/spec/jmespath_spec.rb | spec/jmespath_spec.rb | # frozen_string_literal: true
require 'spec_helper'
module JMESPath
describe '.search' do
it 'searches data' do
expression = 'foo.bar'
data = { 'foo' => { 'bar' => 'value' } }
expect(JMESPath.search(expression, data)).to eq('value')
end
it 'accepts data as a Pathname' do
file_pat... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/spec/indifferent_access_spec.rb | spec/indifferent_access_spec.rb | # frozen_string_literal: true
require 'spec_helper'
module JMESPath
describe '.search' do
describe 'indifferent access' do
it 'treats hashes indifferently with symbols/strings' do
data = { foo: { bar: { yuck: 'abc' } } }
expect(JMESPath.search('foo.bar.yuck', data)).to eq('abc')
end
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
# Using Bundler.require intentionally to simulate environments that have already
# required a specific version of the `json` or `json_pure` gems. The actual version
# loaded is decided by the specific gemfile being loaded from the gemfiles directory.
require 'bundler'
Bundler.require
requ... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/spec/compliance_without_errors_spec.rb | spec/compliance_without_errors_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe 'Compliance' do
PARSER = JMESPath::Parser.new(disable_visit_errors: true)
Dir.glob('spec/compliance/*.json').each do |path|
describe(File.basename(path).split('.').first) do
JMESPath.load_json(path).each do |scenario|
describe("Given #{... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath.rb | lib/jmespath.rb | # frozen_string_literal: true
require 'json'
require 'stringio'
require 'pathname'
module JMESPath
require 'jmespath/caching_parser'
require 'jmespath/errors'
require 'jmespath/lexer'
require 'jmespath/nodes'
require 'jmespath/parser'
require 'jmespath/runtime'
require 'jmespath/token'
require 'jmespat... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/version.rb | lib/jmespath/version.rb | # frozen_string_literal: true
module JMESPath
VERSION = File.read(File.expand_path('../../../VERSION', __FILE__)).strip
end
| ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/errors.rb | lib/jmespath/errors.rb | # frozen_string_literal: true
module JMESPath
module Errors
class Error < StandardError; end
class RuntimeError < Error; end
class SyntaxError < Error; end
class InvalidTypeError < Error; end
class InvalidValueError < Error; end
class InvalidArityError < Error; end
class UnknownFunc... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes.rb | lib/jmespath/nodes.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class Node
def visit(value)
end
def optimize
self
end
def chains_with?(_other)
false
end
end
require 'jmespath/nodes/subexpression'
require 'jmespath/nodes/and'
requ... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/parser.rb | lib/jmespath/parser.rb | # frozen_string_literal: true
require 'set'
module JMESPath
# @api private
class Parser
AFTER_DOT = Set.new([
Lexer::T_IDENTIFIER, # foo.bar
Lexer::T_QUOTED_IDENTIFIER, # foo."bar"
Lexer::T_STAR, # foo.*
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/caching_parser.rb | lib/jmespath/caching_parser.rb | # frozen_string_literal: true
require 'thread'
module JMESPath
class CachingParser
def initialize(options = {})
@parser = options[:parser] || Parser.new(options)
@mutex = Mutex.new
@cache = {}
end
def parse(expression)
if cached = @cache[expression]
cached
else
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/lexer.rb | lib/jmespath/lexer.rb | # frozen_string_literal: true
require 'json'
require 'set'
module JMESPath
# @api private
class Lexer
T_DOT = :dot
T_STAR = :star
T_COMMA = :comma
T_COLON = :colon
T_CURRENT = :current
T_EXPREF = :expref
T_LPAREN = :lparen
T_RPAREN = :rparen
T_LBRACE = :lbrace
T_RBRACE = :rb... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/token_stream.rb | lib/jmespath/token_stream.rb | # frozen_string_literal: true
module JMESPath
# @api private
class TokenStream
# @param [String<JMESPath>] expression
# @param [Array<Token>] tokens
def initialize(expression, tokens)
@expression = expression
@tokens = tokens
@token = nil
@position = -1
self.next
end
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/runtime.rb | lib/jmespath/runtime.rb | # frozen_string_literal: true
module JMESPath
# @api private
class Runtime
# @api private
DEFAULT_PARSER = CachingParser
# Constructs a new runtime object for evaluating JMESPath expressions.
#
# runtime = JMESPath::Runtime.new
# runtime.search(expression, data)
# #=> ...
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/token.rb | lib/jmespath/token.rb | # frozen_string_literal: true
module JMESPath
# @api private
class Token < Struct.new(:type, :value, :position, :binding_power)
NULL_TOKEN = Token.new(:eof, '', nil)
BINDING_POWER = {
Lexer::T_UNKNOWN => 0,
Lexer::T_EOF => 0,
Lexer::T_QUOTED_IDENTIFIER => 0,
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/util.rb | lib/jmespath/util.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Util
class << self
# Determines if a value is false as defined by JMESPath:
#
# https://github.com/jmespath/jmespath.site/blob/master/docs/proposals/improved-filters.rst#and-expressions-1
#
def falsey?(value)
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/multi_select_hash.rb | lib/jmespath/nodes/multi_select_hash.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class MultiSelectHash < Node
def initialize(kv_pairs)
@kv_pairs = kv_pairs
end
def visit(value)
if value.nil?
nil
else
@kv_pairs.each_with_object({}) do |pair, hash|
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/current.rb | lib/jmespath/nodes/current.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class Current < Node
def visit(value)
value
end
end
end
end
| ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/comparator.rb | lib/jmespath/nodes/comparator.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class Comparator < Node
COMPARABLE_TYPES = [Numeric, String].freeze
attr_reader :left, :right
def initialize(left, right)
@left = left
@right = right
end
def self.create(relation, left, rig... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/slice.rb | lib/jmespath/nodes/slice.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class Slice < Node
def initialize(start, stop, step)
@start = start
@stop = stop
@step = step
raise Errors::InvalidValueError, 'slice step cannot be 0' if @step == 0
end
def visit(value)
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/literal.rb | lib/jmespath/nodes/literal.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class Literal < Node
attr_reader :value
def initialize(value)
@value = value
end
def visit(_value)
@value
end
end
end
end
| ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/index.rb | lib/jmespath/nodes/index.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
Index = Field
end
end
| ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/field.rb | lib/jmespath/nodes/field.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class Field < Node
def initialize(key)
@key = key
@key_sym = key.respond_to?(:to_sym) ? key.to_sym : nil
end
def visit(value)
if value.respond_to?(:to_ary) && @key.is_a?(Integer)
value.... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/or.rb | lib/jmespath/nodes/or.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class Or < Node
def initialize(left, right)
@left = left
@right = right
end
def visit(value)
result = @left.visit(value)
if JMESPath::Util.falsey?(result)
@right.visit(value)
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/and.rb | lib/jmespath/nodes/and.rb | # frozen_string_literal: true
module JMESPath
module Nodes
class And < Node
def initialize(left, right)
@left = left
@right = right
end
def visit(value)
result = @left.visit(value)
if JMESPath::Util.falsey?(result)
result
else
@right.v... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/subexpression.rb | lib/jmespath/nodes/subexpression.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class Subexpression < Node
def initialize(left, right)
@left = left
@right = right
end
def visit(value)
@right.visit(@left.visit(value))
end
def optimize
Chain.new(flatten).o... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/not.rb | lib/jmespath/nodes/not.rb | # frozen_string_literal: true
module JMESPath
module Nodes
class Not < Node
def initialize(expression)
@expression = expression
end
def visit(value)
JMESPath::Util.falsey?(@expression.visit(value))
end
def optimize
self.class.new(@expression.optimize)
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/function.rb | lib/jmespath/nodes/function.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class Function < Node
FUNCTIONS = {}
def initialize(children, options = {})
@children = children
@options = options
@disable_visit_errors = @options[:disable_visit_errors]
end
def self.cre... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/projection.rb | lib/jmespath/nodes/projection.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class Projection < Node
def initialize(target, projection)
@target = target
@projection = projection
end
def visit(value)
if (targets = extract_targets(@target.visit(value)))
list = []
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/expression.rb | lib/jmespath/nodes/expression.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class Expression < Node
attr_reader :expression
def initialize(expression)
@expression = expression
end
def visit(_value)
self
end
def eval(value)
@expression.visit(value)
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/multi_select_list.rb | lib/jmespath/nodes/multi_select_list.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class MultiSelectList < Node
def initialize(children)
@children = children
end
def visit(value)
if value.nil?
value
else
@children.map { |n| n.visit(value) }
end
... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/flatten.rb | lib/jmespath/nodes/flatten.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class Flatten < Node
def initialize(child)
@child = child
end
def visit(value)
value = @child.visit(value)
if value.respond_to?(:to_ary)
value.to_ary.each_with_object([]) do |v, values|... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/condition.rb | lib/jmespath/nodes/condition.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
class Condition < Node
def initialize(test, child)
@test = test
@child = child
end
def visit(value)
if JMESPath::Util.falsey?(@test.visit(value))
nil
else
@child.visit... | ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
jmespath/jmespath.rb | https://github.com/jmespath/jmespath.rb/blob/5e86ea7da2e954cc12f5b3a8383a43c0a65acba7/lib/jmespath/nodes/pipe.rb | lib/jmespath/nodes/pipe.rb | # frozen_string_literal: true
module JMESPath
# @api private
module Nodes
Pipe = Subexpression
end
end
| ruby | Apache-2.0 | 5e86ea7da2e954cc12f5b3a8383a43c0a65acba7 | 2026-01-04T17:33:17.925580Z | false |
net-ssh/net-scp | https://github.com/net-ssh/net-scp/blob/29e2c4a7f69cef75dc686d4616a6da45b619a7ae/setup.rb | setup.rb | #
# setup.rb
#
# Copyright (c) 2000-2004 Minero Aoki
#
# This program is free software.
# You can distribute/modify this program under the terms of
# the GNU Lesser General Public License version 2.1.
#
#
# For backward compatibility
#
unless Enumerable.method_defined?(:map)
module Enumerable
alias map collect
... | ruby | MIT | 29e2c4a7f69cef75dc686d4616a6da45b619a7ae | 2026-01-04T17:33:18.088812Z | false |
net-ssh/net-scp | https://github.com/net-ssh/net-scp/blob/29e2c4a7f69cef75dc686d4616a6da45b619a7ae/test/test_all.rb | test/test_all.rb | Dir.chdir(File.dirname(__FILE__)) do
(Dir['**/test_*.rb']-["test_all.rb"]).each { |file| require(file) }
end
| ruby | MIT | 29e2c4a7f69cef75dc686d4616a6da45b619a7ae | 2026-01-04T17:33:18.088812Z | false |
net-ssh/net-scp | https://github.com/net-ssh/net-scp/blob/29e2c4a7f69cef75dc686d4616a6da45b619a7ae/test/common.rb | test/common.rb | require 'test/unit'
require 'mocha/test_unit'
begin
gem 'net-ssh', '>= 2.0.0'
require 'net/ssh'
rescue LoadError
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../net-ssh/lib"
begin
require 'net/ssh'
require 'net/ssh/version'
raise LoadError, 'wrong version' unless Net::SSH::Version::STRING >= '... | ruby | MIT | 29e2c4a7f69cef75dc686d4616a6da45b619a7ae | 2026-01-04T17:33:18.088812Z | false |
net-ssh/net-scp | https://github.com/net-ssh/net-scp/blob/29e2c4a7f69cef75dc686d4616a6da45b619a7ae/test/test_scp.rb | test/test_scp.rb | require 'common'
class TestSCP < Net::SCP::TestCase
def test_start_without_block_should_return_scp_instance
ssh = stub('session', :logger => nil)
Net::SSH.expects(:start).
with("remote.host", "username", { :password => "foo" }).
returns(ssh)
ssh.expects(:close).never
scp = Net::SCP.start... | ruby | MIT | 29e2c4a7f69cef75dc686d4616a6da45b619a7ae | 2026-01-04T17:33:18.088812Z | false |
net-ssh/net-scp | https://github.com/net-ssh/net-scp/blob/29e2c4a7f69cef75dc686d4616a6da45b619a7ae/test/test_download.rb | test/test_download.rb | require 'common'
class TestDownload < Net::SCP::TestCase
def test_download_file_should_transfer_file
file = prepare_file("/path/to/local.txt", "a" * 1234)
expect_scp_session "-f /path/to/remote.txt" do |channel|
simple_download(channel)
end
assert_scripted { scp.download!("/path/to/remote.txt... | ruby | MIT | 29e2c4a7f69cef75dc686d4616a6da45b619a7ae | 2026-01-04T17:33:18.088812Z | false |
net-ssh/net-scp | https://github.com/net-ssh/net-scp/blob/29e2c4a7f69cef75dc686d4616a6da45b619a7ae/test/test_upload.rb | test/test_upload.rb | require 'common'
class TestUpload < Net::SCP::TestCase
def test_upload_file_should_transfer_file
prepare_file("/path/to/local.txt", "a" * 1234)
expect_scp_session "-t /path/to/remote.txt" do |channel|
channel.gets_ok
channel.sends_data "C0666 1234 local.txt\n"
channel.gets_ok
channel... | ruby | MIT | 29e2c4a7f69cef75dc686d4616a6da45b619a7ae | 2026-01-04T17:33:18.088812Z | false |
net-ssh/net-scp | https://github.com/net-ssh/net-scp/blob/29e2c4a7f69cef75dc686d4616a6da45b619a7ae/lib/uri/open-scp.rb | lib/uri/open-scp.rb | require 'open-uri'
require 'uri/scp'
require 'net/scp'
OpenURI::Options[:ssh] = nil
module URI
class SCP
def buffer_open(buf, proxy, open_options)
options = open_options.merge(:port => port, :password => password)
progress = options.delete(:progress_proc)
buf << Net::SCP.download!(host, user,... | ruby | MIT | 29e2c4a7f69cef75dc686d4616a6da45b619a7ae | 2026-01-04T17:33:18.088812Z | false |
net-ssh/net-scp | https://github.com/net-ssh/net-scp/blob/29e2c4a7f69cef75dc686d4616a6da45b619a7ae/lib/uri/scp.rb | lib/uri/scp.rb | require 'uri/generic'
module URI
class SCP < Generic
DEFAULT_PORT = 22
COMPONENT = [
:scheme,
:userinfo,
:host, :port, :path,
:query
].freeze
attr_reader :options
def self.new2(user, password, host, port, path, query)
new('scp', [user, password], host, port, nil, ... | ruby | MIT | 29e2c4a7f69cef75dc686d4616a6da45b619a7ae | 2026-01-04T17:33:18.088812Z | false |
net-ssh/net-scp | https://github.com/net-ssh/net-scp/blob/29e2c4a7f69cef75dc686d4616a6da45b619a7ae/lib/net/scp.rb | lib/net/scp.rb | require 'stringio'
require 'shellwords'
require 'net/ssh'
require 'net/scp/errors'
require 'net/scp/upload'
require 'net/scp/download'
module Net
# Net::SCP implements the SCP (Secure CoPy) client protocol, allowing Ruby
# programs to securely and programmatically transfer individual files or
# entire director... | ruby | MIT | 29e2c4a7f69cef75dc686d4616a6da45b619a7ae | 2026-01-04T17:33:18.088812Z | false |
net-ssh/net-scp | https://github.com/net-ssh/net-scp/blob/29e2c4a7f69cef75dc686d4616a6da45b619a7ae/lib/net/scp/download.rb | lib/net/scp/download.rb | require 'net/scp/errors'
module Net; class SCP
# This module implements the state machine for downloading information from
# a remote server. It exposes no public methods. See Net::SCP#download for
# a discussion of how to use Net::SCP to download data.
module Download
private
# This is the starting ... | ruby | MIT | 29e2c4a7f69cef75dc686d4616a6da45b619a7ae | 2026-01-04T17:33:18.088812Z | false |
net-ssh/net-scp | https://github.com/net-ssh/net-scp/blob/29e2c4a7f69cef75dc686d4616a6da45b619a7ae/lib/net/scp/version.rb | lib/net/scp/version.rb | module Net
class SCP
# A class for describing the current version of a library. The version
# consists of three parts: the +major+ number, the +minor+ number, and the
# +tiny+ (or +patch+) number.
#
# Two Version instances may be compared, so that you can test that a version
# of a library is ... | ruby | MIT | 29e2c4a7f69cef75dc686d4616a6da45b619a7ae | 2026-01-04T17:33:18.088812Z | false |
net-ssh/net-scp | https://github.com/net-ssh/net-scp/blob/29e2c4a7f69cef75dc686d4616a6da45b619a7ae/lib/net/scp/errors.rb | lib/net/scp/errors.rb | module Net; class SCP
class Error < RuntimeError; end
end; end | ruby | MIT | 29e2c4a7f69cef75dc686d4616a6da45b619a7ae | 2026-01-04T17:33:18.088812Z | false |
net-ssh/net-scp | https://github.com/net-ssh/net-scp/blob/29e2c4a7f69cef75dc686d4616a6da45b619a7ae/lib/net/scp/upload.rb | lib/net/scp/upload.rb | require 'net/scp/errors'
module Net; class SCP
# This module implements the state machine for uploading information to
# a remote server. It exposes no public methods. See Net::SCP#upload for
# a discussion of how to use Net::SCP to upload data.
module Upload
private
# The default read chunk size, if... | ruby | MIT | 29e2c4a7f69cef75dc686d4616a6da45b619a7ae | 2026-01-04T17:33:18.088812Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/bookmark_spec.rb | spec/bookmark_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rfd'
describe Rfd::Bookmark do
before do
Rfd::Bookmark.bookmarks.clear
allow(Rfd::Bookmark).to receive(:save) # Stub save to avoid file writes
end
describe '.add' do
it 'adds a path to bookmarks' do
Rfd::Bookmark.add('/tmp/test')
... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/file_ops_spec.rb | spec/file_ops_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rfd'
describe Rfd::FileOps do
include_context 'rfd setup'
describe '#cd' do
context 'to existing directory' do
before do
controller.cd 'dir1'
end
its('current_dir.path') { should == File.join(tmpdir, 'dir1') }
descri... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/viewer_spec.rb | spec/viewer_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rfd'
describe Rfd::Viewer do
# Create a test class that includes the Viewer module
let(:viewer_class) do
Class.new do
include Rfd::Viewer
# Stub methods that Viewer depends on
def osx?
RbConfig::CONFIG['host_os'] =~ /darwin... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/controller_spec.rb | spec/controller_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rfd'
describe Rfd::Controller do
include_context 'rfd setup'
describe '#spawn_panes' do
before { controller.spawn_panes 3 }
subject { controller.main.instance_variable_get :@number_of_panes }
it { should == 3 }
end
describe '#current_... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/commands_spec.rb | spec/commands_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rfd'
describe Rfd::Commands do
include_context 'rfd setup'
describe 'times (0-9)' do
subject { controller.times }
context 'before accepting 0-9' do
it { should == 1 }
end
context 'when 0-9 were typed' do
before do
c... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/rfd_spec.rb | spec/rfd_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rfd'
describe Rfd do
describe 'VERSION' do
it 'is defined' do
expect(Rfd::VERSION).not_to be_nil
end
it 'is a string' do
expect(Rfd::VERSION).to be_a(String)
end
end
end
describe Rfd::Controller do
include_context 'rfd set... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/item_spec.rb | spec/item_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rfd'
require 'tempfile'
require 'fileutils'
describe Rfd::Item do
let(:tmpdir) { Dir.mktmpdir }
after { FileUtils.rm_rf tmpdir }
describe 'basic attributes' do
let(:file_path) { File.join(tmpdir, 'test.txt') }
before { FileUtils.touch file_pat... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
add_group 'Core', 'lib/rfd.rb'
add_group 'Commands', 'lib/rfd/commands.rb'
add_group 'File Operations', 'lib/rfd/file_ops.rb'
add_group 'Item', 'lib/rfd/item.rb'
add_group 'Windows', 'lib/rfd/windows.rb'
add_group 'P... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/support/capture_helper.rb | spec/support/capture_helper.rb | # frozen_string_literal: true
require 'tempfile'
# copied from ActiveSupport 4
module CaptureHelper
def capture(stream)
stream = stream.to_s
captured_stream = Tempfile.new(stream)
stream_io = eval("$#{stream}")
origin_stream = stream_io.dup
stream_io.reopen(captured_stream)
yield
stream... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/support/shared_context.rb | spec/support/shared_context.rb | # frozen_string_literal: true
RSpec.shared_context 'rfd setup' do
include CaptureHelper
SPEC_DIR = File.expand_path('..', __dir__) unless defined?(SPEC_DIR)
let(:spec_dir) { SPEC_DIR }
let(:tmpdir) { File.join SPEC_DIR, 'tmpdir' }
around do |example|
@stdout = capture(:stdout) do
FileUtils.cp_r ... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/preview/result_spec.rb | spec/preview/result_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rfd/preview/result'
describe Rfd::Preview::Result do
describe '#initialize' do
context 'with minimal attributes' do
let(:result) { described_class.new(request_id: 'req-1', status: 'success') }
it 'sets required attributes' do
expec... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/preview/request_spec.rb | spec/preview/request_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rfd/preview/request'
describe Rfd::Preview::Request do
describe '#initialize' do
let(:request) do
described_class.new(
id: 'test-123',
file_path: '/path/to/file.txt',
file_type: :text,
width: 80,
height: 24... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/preview/client_spec.rb | spec/preview/client_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rfd/preview/client'
describe Rfd::Preview::Client do
let(:socket_path) { '/tmp/rfd_test_socket' }
let(:client) { described_class.new(socket_path) }
after { client.close rescue nil }
describe '#initialize' do
it 'sets socket path' do
expec... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/spec/preview/server_spec.rb | spec/preview/server_spec.rb | # frozen_string_literal: true
require 'spec_helper'
require 'rfd/preview/server'
require 'tempfile'
require 'fileutils'
describe Rfd::Preview::Server do
let(:socket_path) { File.join(Dir.tmpdir, "rfd_test_#{$$}.sock") }
let(:server) { described_class.new(socket_path) }
let(:tmpdir) { Dir.mktmpdir }
after { Fi... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd.rb | lib/rfd.rb | # frozen_string_literal: true
require 'curses'
require 'fileutils'
require 'time'
require 'tmpdir'
require 'rubygems/package'
require 'zip'
require 'zip/filesystem'
require 'reline'
require 'rouge'
require_relative 'rfd/commands'
require_relative 'rfd/item'
require_relative 'rfd/windows'
require_relative 'rfd/logging'
... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/file_ops.rb | lib/rfd/file_ops.rb | # frozen_string_literal: true
module Rfd
module FileOps
# Change the current directory.
def cd(dir = '~', pushd: true)
dir = load_item path: expand_path(dir) unless dir.is_a? Item
unless dir.zip?
Dir.chdir dir
@current_zip = nil
else
@current_zip = dir
end
... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/reline_ext.rb | lib/rfd/reline_ext.rb | # frozen_string_literal: true
class Reline::LineEditor
# override render_finished to suppress printing line break
def render_finished; end
end
class Rfd::CommandCancelled < StandardError; end
# ESC key (27) cancels command input
Reline::LineEditor.prepend(Module.new do
def input_key(key)
raise Rfd::Command... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/item.rb | lib/rfd/item.rb | # frozen_string_literal: true
module Rfd
class Item
include Comparable
attr_reader :name, :dir, :stat
attr_accessor :index
def initialize(path: nil, dir: nil, name: nil, stat: nil, window_width: nil)
@path, @dir, @name, @stat, @window_width, @marked = path, dir || File.dirname(path), name || Fi... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/sub_window.rb | lib/rfd/sub_window.rb | # frozen_string_literal: true
module Rfd
# Base class for sub-windows (preview, tree, etc.)
class SubWindow
attr_reader :window, :controller
def initialize(controller)
@controller = controller
@window = create_window
end
def create_window
Curses::Window.new(height, width, top, l... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/logging.rb | lib/rfd/logging.rb | # frozen_string_literal: true
require 'logger'
module Rfd
@logger = nil
class << self
def log_to(file)
@logger = Logger.new file
@logger.debug 'hello'
Rfd::Controller.include Logging
end
def log(str)
Rfd.logger.debug str if Rfd.logger
end
attr_reader :logger
end
... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/preview_window.rb | lib/rfd/preview_window.rb | # frozen_string_literal: true
module Rfd
class PreviewWindow < SubWindow
# Module for Rouge syntax highlighting support (extractable for testing)
module RougeSupport
ROUGE_COLORS = {
'Comment' => Curses::COLOR_GREEN,
'Keyword' => Curses::COLOR_CYAN,
'Name.Function' => Curses::CO... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/filter_input.rb | lib/rfd/filter_input.rb | # frozen_string_literal: true
module Rfd
class FilterInput
attr_accessor :text
def initialize(&on_change)
@text = ''
@on_change = on_change
end
def clear
return if @text.empty?
@text = ''
@on_change&.call
end
def backspace
return if @text.empty?
@t... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/commands.rb | lib/rfd/commands.rb | # frozen_string_literal: true
using Module.new {
refine Module do
def group(label, description)
methods_before = instance_methods(false)
yield
Rfd::Commands.command_groups << {category: self, label: label, methods: instance_methods(false) - methods_before, description: description}
end
... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/navigation_window.rb | lib/rfd/navigation_window.rb | # frozen_string_literal: true
module Rfd
# Tree node for directory tree browser
TreeNode = Struct.new(:path, :name, :relative_path, :depth, :expanded, :children, :parent, keyword_init: true) do
def has_subdirs?
return false unless File.directory?(path)
@has_subdirs = Dir.children(path).any? { |c| F... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/viewer.rb | lib/rfd/viewer.rb | # frozen_string_literal: true
module Rfd
module Viewer
# Open current file or directory with the editor.
def edit
execute_external_command do
editor = ENV['EDITOR'] || 'vim'
unless in_zip?
system editor, current_item.path
else
begin
tmpdir, tmpfil... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/bookmark.rb | lib/rfd/bookmark.rb | # frozen_string_literal: true
module Rfd
module Bookmark
CONFIG_DIR = File.join(ENV.fetch('XDG_CONFIG_HOME') { File.expand_path('~/.config') }, 'rfd')
BOOKMARK_FILE = File.join(CONFIG_DIR, 'bookmarks')
@bookmarks = []
class << self
attr_accessor :bookmarks
def add(path)
path = ... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/windows.rb | lib/rfd/windows.rb | # frozen_string_literal: true
require 'delegate'
module Rfd
class Window < DelegateClass(Curses::Window)
def self.draw_borders
[[5, Curses.stdscr.maxx, 0, 0], [5, Curses.cols - 30, 0, 0], [Curses.stdscr.maxy - 5, Curses.stdscr.maxx, 4, 0]].each do |height, width, top, left|
w = Curses.stdscr.subwin... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/help_generator.rb | lib/rfd/help_generator.rb | # frozen_string_literal: true
# Ensure commands are loaded to register groups
require_relative 'commands' unless defined?(Rfd::Commands)
module Rfd
module HelpGenerator
CACHE_FILE = File.join(__dir__, 'help.txt')
class << self
def generate
# Use cached file if available
return File.re... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/bookmark_window.rb | lib/rfd/bookmark_window.rb | # frozen_string_literal: true
module Rfd
class BookmarkWindow < SubWindow
def initialize(controller)
super(controller)
@cursor = 0
@scroll = 0
@filter = FilterInput.new { apply_filter }
@filtered_items = nil
end
def all_items
Bookmark.bookmarks
end
def displa... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/preview/result.rb | lib/rfd/preview/result.rb | # frozen_string_literal: true
module Rfd
module Preview
# Value object representing a preview generation result
class Result
attr_reader :request_id, :status, :file_type, :lines, :thumbnail_path, :metadata, :error
def initialize(request_id:, status:, file_type: nil, lines: nil, thumbnail_path: n... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/preview/client.rb | lib/rfd/preview/client.rb | # frozen_string_literal: true
require 'socket'
require 'json'
require 'securerandom'
require_relative 'request'
require_relative 'result'
module Rfd
module Preview
# Client interface for communicating with the preview server from the main process
class Client
attr_reader :socket_io
def initiali... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/preview/server.rb | lib/rfd/preview/server.rb | # frozen_string_literal: true
require 'socket'
require 'json'
require 'tmpdir'
require 'timeout'
require 'rouge'
require_relative 'request'
require_relative 'result'
module Rfd
module Preview
# Forked process that handles preview generation asynchronously
class Server
TIMEOUT = (ENV['RFD_PREVIEW_TIMEO... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
amatsuda/rfd | https://github.com/amatsuda/rfd/blob/969e9aed58f4e31d09a798c5310e3ee3e74088e3/lib/rfd/preview/request.rb | lib/rfd/preview/request.rb | # frozen_string_literal: true
module Rfd
module Preview
# Value object representing a preview generation request
class Request
attr_reader :id, :file_path, :file_type, :width, :height, :timestamp
def initialize(id:, file_path:, file_type:, width:, height:)
@id = id
@file_path = f... | ruby | MIT | 969e9aed58f4e31d09a798c5310e3ee3e74088e3 | 2026-01-04T17:33:25.015329Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/Policyfile.rb | Policyfile.rb | # Policyfile.rb - Describe how you want Chef Infra Client to build your system.
name 'homebrew'
# Where to find external cookbooks:
default_source :supermarket
# run_list: chef-client will run these recipes in the order specified.
run_list 'test::default'
# Specify a custom source for a single cookbook:
cookbook 'h... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/metadata.rb | metadata.rb | name 'homebrew'
maintainer 'Sous Chefs'
maintainer_email 'help@sous-chefs.org'
license 'Apache-2.0'
description 'Install Homebrew and includes resources for working with taps and casks'
version '6.0.3'
supports 'mac_os_x'
source_url 'https://github.com/sous-chefs/homebr... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/test/integration/default/default_spec.rb | test/integration/default/default_spec.rb | # Check both x86_64 and arm64 locations for brew
# Depending on shell setup in the box:
# InSpec commands want a full path, but this depends on arch + platform_version
# macOS default shell may be /bin/bash or /bin/zsh ... back to basics: /bin/sh
describe command('/bin/sh -c "PATH=/opt/homebrew/bin:/usr/local/bin:$PATH... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/test/cookbooks/test/metadata.rb | test/cookbooks/test/metadata.rb | name 'test'
license 'Apache-2.0'
description 'Tests homebrew'
version '0.1.0'
depends 'homebrew'
depends 'ssh_known_hosts'
| ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/test/cookbooks/test/recipes/default.rb | test/cookbooks/test/recipes/default.rb | #
# Cookbook:: test
# Recipe:: default
#
# Copyright:: 2016-2019, Chef Software, Inc.
node.default['homebrew']['formulas'] = %w(redis jq)
node.default['homebrew']['casks'] = %w(caffeine)
node.default['homebrew']['taps'] = [
{
'tap' => 'homebrew/bundle',
'full' => true,
},
{
'tap' => 'homebrew/service... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/recipes/default.rb | recipes/default.rb | #
# Author:: Joshua Timberman (<jtimberman@chef.io>)
# Author:: Graeme Mathieson (<mathie@woss.name>)
# Cookbook:: homebrew
# Recipe:: default
#
# Copyright:: 2011-2019, Chef Software, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/recipes/install_taps.rb | recipes/install_taps.rb | #
# Cookbook:: homebrew
# Recipes:: install_taps
#
# Copyright:: 2015-2019, Chef Software, Inc <legal@chef.io>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/li... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
sous-chefs/homebrew | https://github.com/sous-chefs/homebrew/blob/464b4d4817cf498cba624867534b1f728e0fe0f4/recipes/install_formulas.rb | recipes/install_formulas.rb | #
# Cookbook:: homebrew
# Recipes:: install_casks
#
# Copyright:: 2014-2019, Chef Software, Inc <legal@chef.io>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... | ruby | Apache-2.0 | 464b4d4817cf498cba624867534b1f728e0fe0f4 | 2026-01-04T17:33:26.470565Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.