source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/matcher_builders/node_has_positional_argument.rb | Ruby | mit | 88 | main | 1,329 | # frozen_string_literal: true
module Leftovers
module MatcherBuilders
module NodeHasPositionalArgument
class << self
def build(positions, value_matcher)
positions = ::Leftovers.wrap_array(positions)
if !positions.empty? && !all_positions?(positions) && value_matcher
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/matcher_builders/node_type.rb | Ruby | mit | 88 | main | 1,100 | # frozen_string_literal: true
require 'set'
module Leftovers
module MatcherBuilders
module NodeType
def self.build(types_pattern) # rubocop:disable Metrics
Or.each_or_self(types_pattern) do |type|
case type
when :Symbol then Matchers::NodeType.new(:sym)
when :String t... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/matcher_builders/and.rb | Ruby | mit | 88 | main | 867 | # frozen_string_literal: true
module Leftovers
module MatcherBuilders
module And
class << self
def build(matchers)
matchers = flatten(matchers).compact
case matchers.length
when 0 then nil
when 1 then matchers.first
when 2 then Matchers::And.new(mat... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/matcher_builders/node_privacy.rb | Ruby | mit | 88 | main | 275 | # frozen_string_literal: true
module Leftovers
module MatcherBuilders
module NodePrivacy
def self.build(privacy_settings)
Or.each_or_self(privacy_settings) do |privacy|
Matchers::NodePrivacy.new(privacy)
end
end
end
end
end |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/matcher_builders/node_value.rb | Ruby | mit | 88 | main | 1,934 | # frozen_string_literal: true
module Leftovers
module MatcherBuilders
module NodeValue
class << self
def build(patterns)
Or.each_or_self(patterns) do |pattern|
case pattern
when ::Integer, ::Float, true, false then Matchers::NodeScalarValue.new(pattern)
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/matcher_builders/node_pair_key.rb | Ruby | mit | 88 | main | 314 | # frozen_string_literal: true
module Leftovers
module MatcherBuilders
module NodePairKey
def self.build(key_matcher)
return unless key_matcher
And.build([
Matchers::NodeType.new(:pair),
Matchers::NodePairKey.new(key_matcher)
])
end
end
end
end |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/matcher_builders/node_has_argument.rb | Ruby | mit | 88 | main | 1,821 | # frozen_string_literal: true
module Leftovers
module MatcherBuilders
module NodeHasArgument
class << self
def build(patterns)
Or.each_or_self(patterns) do |pat|
case pat
when ::String then NodeHasKeywordArgument.build(pat, nil)
when ::Integer then Node... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/matcher_builders/node_path.rb | Ruby | mit | 88 | main | 251 | # frozen_string_literal: true
module Leftovers
module MatcherBuilders
module NodePath
def self.build(path_pattern)
matcher = Path.build(path_pattern)
Matchers::NodePath.new(matcher) if matcher
end
end
end
end |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/matcher_builders/node.rb | Ruby | mit | 88 | main | 1,802 | # frozen_string_literal: true
module Leftovers
module MatcherBuilders
module Node
class << self
def build(patterns)
Or.each_or_self(patterns) do |pattern|
case pattern
when ::String then NodeName.build(pattern)
when ::Hash then build_from_hash(**pattern... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/matcher_builders/path.rb | Ruby | mit | 88 | main | 370 | # frozen_string_literal: true
require 'fast_ignore'
module Leftovers
module MatcherBuilders
module Path
def self.build(path_pattern)
return if path_pattern.nil? || path_pattern.empty?
Matchers::Path.new(
::FastIgnore.new(include_rules: path_pattern, gitignore: false, root: ::Lef... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/matcher_builders/node_pair_value.rb | Ruby | mit | 88 | main | 324 | # frozen_string_literal: true
module Leftovers
module MatcherBuilders
module NodePairValue
def self.build(value_matcher)
return unless value_matcher
And.build([
Matchers::NodeType.new(:pair),
Matchers::NodePairValue.new(value_matcher)
])
end
end
end
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/precompilers/haml.rb | Ruby | mit | 88 | main | 852 | # frozen_string_literal: true
require 'haml'
module Leftovers
module Precompilers
module Haml
HAML_RUNTIME_ERROR_RE = %r{
\A
_buf\s=\s'' # preamble
[\s;]*
# https://github.com/haml/haml/blob/main/lib/haml/compiler.rb#L93
raise\s(?:::)?(?<class>.*)\.new\(%q\[(?<messa... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/precompilers/json.rb | Ruby | mit | 88 | main | 499 | # frozen_string_literal: true
require 'json'
module Leftovers
module Precompilers
module JSON
class << self
def precompile(json)
"__leftovers_document(#{to_ruby_argument(::JSON.parse(json))})"
end
private
def to_ruby_argument(value)
ruby = value.inspec... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/precompilers/erb.rb | Ruby | mit | 88 | main | 434 | # frozen_string_literal: true
require 'erb'
module Leftovers
module Precompilers
class ERB < ::ERB::Compiler
def self.precompile(erb)
@compiler ||= new('-')
@compiler.compile(erb).first
end
def add_insert_cmd(out, content) # leftovers:keep
out.push("\n#{content}\n")
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/precompilers/precompiler.rb | Ruby | mit | 88 | main | 629 | # frozen_string_literal: true
require 'json'
module Leftovers
module Precompilers
class Precompiler
def initialize(precompiler, matcher)
@precompiler = precompiler
@matcher = matcher
end
def precompile(content, file)
return unless @matcher === file.relative_path
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/precompilers/yaml.rb | Ruby | mit | 88 | main | 494 | # frozen_string_literal: true
require 'yaml'
module Leftovers
module Precompilers
module YAML
include Autoloader
def self.precompile(yaml)
builder = Builder.new
parser = ::Psych::Parser.new(builder)
parser.parse(yaml)
builder.to_ruby_file
rescue ::Psych::Synta... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/precompilers/slim.rb | Ruby | mit | 88 | main | 335 | # frozen_string_literal: true
require 'slim'
module Leftovers
module Precompilers
module Slim
def self.precompile(file)
::Slim::Engine.new(file: file).call(file)
rescue ::Slim::Parser::SyntaxError => e
raise PrecompileError.new(e.error, line: e.lineno, column: e.column)
end
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/precompilers/yaml/builder.rb | Ruby | mit | 88 | main | 1,307 | # frozen_string_literal: true
module Leftovers
module Precompilers
module YAML
class Builder < ::Psych::TreeBuilder
def initialize
@constants = []
super
end
def add_constant_for_tag(tag, value = nil)
match = %r{\A!ruby/[^:]*(?::(.*))?\z}.match(tag)
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/add_dynamic_suffix.rb | Ruby | mit | 88 | main | 654 | # frozen_string_literal: true
module Leftovers
module Processors
class AddDynamicSuffix
include ComparableInstance
def initialize(suffix_processor, then_processor)
@suffix_processor = suffix_processor
@then_processor = then_processor
freeze
end
def process(str, ... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/positional_argument.rb | Ruby | mit | 88 | main | 658 | # frozen_string_literal: true
module Leftovers
module Processors
class PositionalArgument
include ComparableInstance
def initialize(index, then_processor)
@index = index
@then_processor = then_processor
freeze
end
def process(_str, current_node, matched_node, ac... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/titleize.rb | Ruby | mit | 88 | main | 766 | # frozen_string_literal: true
module Leftovers
module Processors
class Titleize
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
return unless str
@th... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/camelize.rb | Ruby | mit | 88 | main | 766 | # frozen_string_literal: true
module Leftovers
module Processors
class Camelize
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
return unless str
@th... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/itself.rb | Ruby | mit | 88 | main | 407 | # frozen_string_literal: true
module Leftovers
module Processors
class Itself
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(_str, current_node, matched_node, acc)
@then_processor.process(current... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/receiver.rb | Ruby | mit | 88 | main | 478 | # frozen_string_literal: true
module Leftovers
module Processors
class Receiver
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(_str, current_node, matched_node, acc)
receiver = matched_node.recei... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/pluralize.rb | Ruby | mit | 88 | main | 769 | # frozen_string_literal: true
module Leftovers
module Processors
class Pluralize
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
return unless str
@t... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/set_privacy.rb | Ruby | mit | 88 | main | 360 | # frozen_string_literal: true
module Leftovers
module Processors
class SetPrivacy
include ComparableInstance
def initialize(to)
@to = to
freeze
end
def process(str, _current_node, _matched_node, acc)
return unless str
acc.set_privacy(str.to_sym, @to)
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/upcase.rb | Ruby | mit | 88 | main | 426 | # frozen_string_literal: true
module Leftovers
module Processors
class Upcase
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
return unless str
@then... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/delete_suffix.rb | Ruby | mit | 88 | main | 481 | # frozen_string_literal: true
module Leftovers
module Processors
class DeleteSuffix
include ComparableInstance
def initialize(suffix, then_processor)
@suffix = suffix
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/set_default_privacy.rb | Ruby | mit | 88 | main | 341 | # frozen_string_literal: true
module Leftovers
module Processors
class SetDefaultPrivacy
include ComparableInstance
def initialize(to)
@to = to
freeze
end
def process(_str, _current_node, _matched_node, acc)
acc.default_method_privacy = @to
end
free... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/add_prefix.rb | Ruby | mit | 88 | main | 470 | # frozen_string_literal: true
module Leftovers
module Processors
class AddPrefix
include ComparableInstance
def initialize(prefix, then_processor)
@prefix = prefix
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/add_suffix.rb | Ruby | mit | 88 | main | 470 | # frozen_string_literal: true
module Leftovers
module Processors
class AddSuffix
include ComparableInstance
def initialize(suffix, then_processor)
@suffix = suffix
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/delete_before_last.rb | Ruby | mit | 88 | main | 643 | # frozen_string_literal: true
module Leftovers
module Processors
class DeleteBeforeLast
include ComparableInstance
def initialize(delete_before, then_processor)
@delete_before = delete_before
@delete_before_length = delete_before.length
@then_processor = then_processor
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/match_current_node.rb | Ruby | mit | 88 | main | 532 | # frozen_string_literal: true
module Leftovers
module Processors
class MatchCurrentNode
include ComparableInstance
attr_reader :matcher, :then_processor
def initialize(matcher, then_processor)
@matcher = matcher
@then_processor = then_processor
freeze
end
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/delete_prefix.rb | Ruby | mit | 88 | main | 481 | # frozen_string_literal: true
module Leftovers
module Processors
class DeletePrefix
include ComparableInstance
def initialize(prefix, then_processor)
@prefix = prefix
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/each_keyword.rb | Ruby | mit | 88 | main | 606 | # frozen_string_literal: true
module Leftovers
module Processors
class EachKeyword
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(_str, current_node, matched_node, acc)
kwargs = current_node.kwar... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/each_positional_argument.rb | Ruby | mit | 88 | main | 610 | # frozen_string_literal: true
module Leftovers
module Processors
class EachPositionalArgument
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(_str, current_node, matched_node, acc)
positional_argu... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/add_call.rb | Ruby | mit | 88 | main | 266 | # frozen_string_literal: true
module Leftovers
module Processors
module AddCall
def self.process(str, _current_node, _matched_node, acc)
return unless str
return if str.empty?
acc.calls << str.to_sym
end
end
end
end |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/delete_before.rb | Ruby | mit | 88 | main | 638 | # frozen_string_literal: true
module Leftovers
module Processors
class DeleteBefore
include ComparableInstance
def initialize(delete_before, then_processor)
@delete_before = delete_before
@delete_before_length = delete_before.length
@then_processor = then_processor
f... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/placeholder.rb | Ruby | mit | 88 | main | 335 | # frozen_string_literal: true
module Leftovers
module Processors
class Placeholder
def processor=(value)
@processor = value
freeze
end
def process(str, current_node, matched_node, acc)
@processor.process(str, current_node, matched_node, acc)
end
freeze
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/add_dynamic_prefix.rb | Ruby | mit | 88 | main | 654 | # frozen_string_literal: true
module Leftovers
module Processors
class AddDynamicPrefix
include ComparableInstance
def initialize(prefix_processor, then_processor)
@prefix_processor = prefix_processor
@then_processor = then_processor
freeze
end
def process(str, ... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/underscore.rb | Ruby | mit | 88 | main | 772 | # frozen_string_literal: true
module Leftovers
module Processors
class Underscore
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
return unless str
@... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/each_for_definition_set.rb | Ruby | mit | 88 | main | 748 | # frozen_string_literal: true
module Leftovers
module Processors
class EachForDefinitionSet
include ComparableInstance
attr_reader :processors
def initialize(processors)
@processors = processors
freeze
end
def process(str, current_node, matched_node, acc) # ruboc... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/singularize.rb | Ruby | mit | 88 | main | 775 | # frozen_string_literal: true
module Leftovers
module Processors
class Singularize
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
return unless str
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/downcase.rb | Ruby | mit | 88 | main | 430 | # frozen_string_literal: true
module Leftovers
module Processors
class Downcase
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
return unless str
@th... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/add_definition_node.rb | Ruby | mit | 88 | main | 340 | # frozen_string_literal: true
module Leftovers
module Processors
module AddDefinitionNode
def self.process(str, current_node, _matched_node, acc)
return unless str
return if str.empty?
acc.add_definition_node DefinitionNode.new(current_node, name: str.to_sym)
end
freez... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/split.rb | Ruby | mit | 88 | main | 522 | # frozen_string_literal: true
module Leftovers
module Processors
class Split
include ComparableInstance
def initialize(split_on, then_processor)
@split_on = split_on
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/capitalize.rb | Ruby | mit | 88 | main | 434 | # frozen_string_literal: true
module Leftovers
module Processors
class Capitalize
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
return unless str
@... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/match_matched_node.rb | Ruby | mit | 88 | main | 532 | # frozen_string_literal: true
module Leftovers
module Processors
class MatchMatchedNode
include ComparableInstance
attr_reader :matcher, :then_processor
def initialize(matcher, then_processor)
@matcher = matcher
@then_processor = then_processor
freeze
end
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/each_positional_argument_from.rb | Ruby | mit | 88 | main | 708 | # frozen_string_literal: true
module Leftovers
module Processors
class EachPositionalArgumentFrom
include ComparableInstance
def initialize(position, then_processor)
@position = position
@then_processor = then_processor
freeze
end
def process(_str, current_node,... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/swapcase.rb | Ruby | mit | 88 | main | 430 | # frozen_string_literal: true
module Leftovers
module Processors
class Swapcase
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
return unless str
@th... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/each.rb | Ruby | mit | 88 | main | 457 | # frozen_string_literal: true
module Leftovers
module Processors
class Each
include ComparableInstance
attr_reader :processors
def initialize(processors)
@processors = processors
freeze
end
def process(str, current_node, matched_node, acc)
@processors.eac... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/delete_after_last.rb | Ruby | mit | 88 | main | 559 | # frozen_string_literal: true
module Leftovers
module Processors
class DeleteAfterLast
include ComparableInstance
def initialize(delete_after, then_processor)
@delete_after = delete_after
@then_processor = then_processor
freeze
end
def process(str, current_node,... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/append_sym.rb | Ruby | mit | 88 | main | 233 | # frozen_string_literal: true
module Leftovers
module Processors
module AppendSym
def self.process(str, _current_node, _matched_node, acc)
return unless str
acc << str.to_sym
end
end
end
end |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/delete_after.rb | Ruby | mit | 88 | main | 554 | # frozen_string_literal: true
module Leftovers
module Processors
class DeleteAfter
include ComparableInstance
def initialize(delete_after, then_processor)
@delete_after = delete_after
@then_processor = then_processor
freeze
end
def process(str, current_node, mat... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/keyword_argument.rb | Ruby | mit | 88 | main | 652 | # frozen_string_literal: true
module Leftovers
module Processors
class KeywordArgument
include ComparableInstance
def initialize(matcher, then_processor)
@matcher = matcher
@then_processor = then_processor
freeze
end
def process(_str, current_node, matched_node,... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/deconstantize.rb | Ruby | mit | 88 | main | 781 | # frozen_string_literal: true
module Leftovers
module Processors
class Deconstantize
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
return unless str
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/replace_value.rb | Ruby | mit | 88 | main | 432 | # frozen_string_literal: true
module Leftovers
module Processors
class ReplaceValue
include ComparableInstance
def initialize(value, then_processor)
@value = value
@then_processor = then_processor
freeze
end
def process(_str, current_node, matched_node, acc)
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/demodulize.rb | Ruby | mit | 88 | main | 772 | # frozen_string_literal: true
module Leftovers
module Processors
class Demodulize
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
return unless str
@... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/parameterize.rb | Ruby | mit | 88 | main | 778 | # frozen_string_literal: true
module Leftovers
module Processors
class Parameterize
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(str, current_node, matched_node, acc)
return unless str
... |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/eval.rb | Ruby | mit | 88 | main | 306 | # frozen_string_literal: true
module Leftovers
module Processors
module Eval
def self.process(str, current_node, _matched_node, acc)
return unless str
return if str.empty?
acc.collect_subfile(str, current_node.loc.expression)
end
freeze
end
end
end |
github | robotdana/leftovers | https://github.com/robotdana/leftovers | lib/leftovers/processors/each_keyword_argument.rb | Ruby | mit | 88 | main | 621 | # frozen_string_literal: true
module Leftovers
module Processors
class EachKeywordArgument
include ComparableInstance
def initialize(then_processor)
@then_processor = then_processor
freeze
end
def process(_str, current_node, matched_node, acc)
kwargs = current_n... |
github | wbzyl/rack-codehighlighter | https://github.com/wbzyl/rack-codehighlighter | rack-codehighlighter.gemspec | Ruby | mit | 88 | master | 704 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "rack-codehighlighter"
s.version = "0.6.0"
s.platform = Gem::Platform::RUBY
s.authors = ["Włodek Bzyl"]
s.email = ["matwb@ug.edu.pl"]
s.homepage = "http://tao.inf.ug.edu.pl/"
s.summary = %q{Rack Middleware for... |
github | wbzyl/rack-codehighlighter | https://github.com/wbzyl/rack-codehighlighter | lib/rack/codehighlighter.rb | Ruby | mit | 88 | master | 5,665 | require 'rack/utils'
require 'nokogiri'
module Rack
class Codehighlighter
include Rack::Utils
# for logging use
FORMAT = %{%s - [%s] [%s] "%s %s%s %s" (%s) %d %d %0.4f\n}
def initialize(app, highlighter = :censor, opts = {})
@app = app
@highlighter = highlighter
@opts = {
... |
github | wbzyl/rack-codehighlighter | https://github.com/wbzyl/rack-codehighlighter | examples/ultraviolet.ru | Ruby | mit | 88 | master | 311 | $:.unshift File.dirname(__FILE__)
require 'app'
use Rack::ShowExceptions
use Rack::Lint
require 'uv'
use Rack::Codehighlighter, :ultraviolet,
:element => "pre", :pattern => /\A:::(\w+)\s*\n/,
:themes => {"cobalt" => ["ruby"], "zenburnesque" => ["c", "sql"]},
:logging => true
run Sinatra::Application |
github | wbzyl/rack-codehighlighter | https://github.com/wbzyl/rack-codehighlighter | examples/syntax.ru | Ruby | mit | 88 | master | 256 | $:.unshift File.dirname(__FILE__)
require 'app'
use Rack::ShowExceptions
use Rack::Lint
require 'syntax/convertors/html'
use Rack::Codehighlighter, :syntax, :element => "pre", :pattern => /\A:::([-_+\w]+)\s*\n/, :logging => true
run Sinatra::Application |
github | wbzyl/rack-codehighlighter | https://github.com/wbzyl/rack-codehighlighter | examples/coderay.ru | Ruby | mit | 88 | master | 238 | $:.unshift File.dirname(__FILE__)
require 'app'
use Rack::ShowExceptions
use Rack::Lint
require 'coderay'
use Rack::Codehighlighter, :coderay, :element => "pre", :pattern => /\A:::(\w+)\s*\n/, :logging => true
run Sinatra::Application |
github | wbzyl/rack-codehighlighter | https://github.com/wbzyl/rack-codehighlighter | examples/example.rb | Ruby | mit | 88 | master | 397 | path = File.expand_path("../lib")
$:.unshift(path) unless $:.include?(path)
require 'rubygems'
require 'sinatra'
require 'rack/codehighlighter'
use Rack::Codehighlighter, :censor, :reason => '[[--difficult code removed--]]'
get "/" do
erb :hello
end
__END__
@@ hello
<h3>Fibonacci numbers in Ruby</h3>
<pre>:::ruby... |
github | wbzyl/rack-codehighlighter | https://github.com/wbzyl/rack-codehighlighter | examples/pygments_api.ru | Ruby | mit | 88 | master | 232 | $:.unshift File.dirname(__FILE__)
require 'app'
use Rack::ShowExceptions
use Rack::Lint
use Rack::Codehighlighter, :pygments_api, :element => "pre",
:pattern => /\A:::([-_+\w]+)\s*\n/, :logging => true
run Sinatra::Application |
github | wbzyl/rack-codehighlighter | https://github.com/wbzyl/rack-codehighlighter | examples/pygments.ru | Ruby | mit | 88 | master | 245 | $:.unshift File.dirname(__FILE__)
require 'app'
use Rack::ShowExceptions
use Rack::Lint
require 'rygments'
use Rack::Codehighlighter, :pygments, :element => "pre", :pattern => /\A:::([-_+\w]+)\s*\n/, :logging => true
run Sinatra::Application |
github | wbzyl/rack-codehighlighter | https://github.com/wbzyl/rack-codehighlighter | examples/check.rb | Ruby | mit | 88 | master | 579 | require 'rubygems'
require 'coderay'
require 'uv'
require 'syntax/convertors/html'
require 'rygments'
#require 'pygments'
str = "def hitch; end"
puts "---- Syntax ----"
puts Syntax::Convertors::HTML.for_syntax('ruby').convert(str)
puts "---- Coderay ----"
puts CodeRay.encoder(:html).encode(str, 'ruby')
puts "---- ... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | Gemfile | Ruby | apache-2.0 | 88 | main | 366 | source 'https://rubygems.org'
gemspec
group :test do
gem 'rake'
gem 'rspec', '~> 3.1'
gem 'rspec-collection_matchers', '~> 1.0'
gem 'rspec-its', '~> 1.0'
gem 'rubocop', '~> 1.64.0'
gem 'rubocop-rspec', '~> 3.0'
gem 'rubocop-performance', '~> 1.16'
gem 'simplecov'
gem 'simplecov-console'
end
group... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | Rakefile | Ruby | apache-2.0 | 88 | main | 411 | require 'bundler/gem_tasks'
require 'rubocop/rake_task'
require 'puppet_litmus/version'
require 'rspec/core/rake_task'
require 'yard'
RSpec::Core::RakeTask.new(:spec)
task :default => :spec
namespace :spec do
desc 'Run RSpec code examples with coverage collection'
task :coverage do
ENV['COVERAGE'] = '... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | puppet_litmus.gemspec | Ruby | apache-2.0 | 88 | main | 1,397 | # frozen_string_literal: true
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'puppet_litmus/version'
Gem::Specification.new do |spec|
spec.name = 'puppet_litmus'
spec.version = PuppetLitmus::VERSION
spec.homepage = 'https://github.com/puppetlabs/pup... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | lib/puppet_litmus.rb | Ruby | apache-2.0 | 88 | main | 506 | # frozen_string_literal: true
# Helper methods for testing puppet content
module PuppetLitmus; end
require 'bolt_spec/run'
require 'puppet_litmus/inventory_manipulation'
require 'puppet_litmus/puppet_helpers'
require 'puppet_litmus/rake_helper'
require 'puppet_litmus/spec_helper_acceptance'
# Helper methods for test... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | lib/puppet_litmus/rake_tasks.rb | Ruby | apache-2.0 | 88 | main | 18,690 | # frozen_string_literal: true
require 'rake'
namespace :litmus do
require 'puppet_litmus/inventory_manipulation'
require 'puppet_litmus/rake_helper'
include PuppetLitmus::InventoryManipulation
include PuppetLitmus::RakeHelper
# Prints all supported OSes from metadata.json file.
desc 'print all supported O... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | lib/puppet_litmus/puppet_helpers.rb | Ruby | apache-2.0 | 88 | main | 20,159 | # frozen_string_literal: true
# helper functions for running puppet commands. They execute a target system specified by ENV['TARGET_HOST']
# heavily uses functions from here https://github.com/puppetlabs/bolt/blob/main/developer-docs/bolt_spec-run.md
module PuppetLitmus::PuppetHelpers
# Applies a manifest twice. Fir... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | lib/puppet_litmus/rake_helper.rb | Ruby | apache-2.0 | 88 | main | 17,328 | # frozen_string_literal: true
require 'bolt_spec/run'
require 'puppet_litmus/version'
# helper methods for the litmus rake tasks
module PuppetLitmus::RakeHelper # rubocop:disable Metrics/ModuleLength
# DEFAULT_CONFIG_DATA should be frozen for our safety, but it needs to work around https://github.com/puppetlabs/bol... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | lib/puppet_litmus/spec_helper_acceptance.rb | Ruby | apache-2.0 | 88 | main | 4,754 | # frozen_string_literal: true
# Helper methods for testing puppet content
module PuppetLitmus
extend PuppetLitmus::InventoryManipulation
def self.configure!
require 'serverspec'
RSpec.configure do |config|
config.include PuppetLitmus
config.extend PuppetLitmus
end
if ENV['TARGET_HOST... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | lib/puppet_litmus/util.rb | Ruby | apache-2.0 | 88 | main | 938 | # frozen_string_literal: true
# Helper methods for testing puppet content
module PuppetLitmus::Util
# Ensure that a passed command is base 64 encoded and passed to PowerShell; this obviates the need to
# carefully interpolate strings for passing to ruby which will then be passed to PowerShell/CMD which will
# th... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | lib/puppet_litmus/inventory_manipulation.rb | Ruby | apache-2.0 | 88 | main | 12,875 | # frozen_string_literal: true
module PuppetLitmus; end # rubocop:disable Style/Documentation
# helper functions for manipulating and reading a bolt inventory file
module PuppetLitmus::InventoryManipulation
# Creates an inventory hash from the inventory.yaml.
#
# @param inventory_full_path [String] path to the l... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | spec/spec_helper.rb | Ruby | apache-2.0 | 88 | main | 1,639 | # frozen_string_literal: true
require 'rspec'
require 'open3'
require 'ostruct'
if ENV['COVERAGE'] == 'yes'
begin
require 'simplecov'
require 'simplecov-console'
SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::Console
]
SimpleCov.start do
tr... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | spec/support/inventory.rb | Ruby | apache-2.0 | 88 | main | 4,750 | # frozen_string_literal: true
def no_config_hash
{ 'groups' =>
[
{ 'name' => 'ssh_nodes',
'targets' =>
[{ 'uri' => 'test.delivery.puppetlabs.net',
'facts' => { 'provisioner' => 'vmpooler', 'platform' => 'centos-5-x86_64' } }] },
{ 'name' => 'winrm_nodes', 'targets' => [] }
... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | spec/exe/matrix_from_metadata_v3_spec.rb | Ruby | apache-2.0 | 88 | main | 12,774 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'matrix_from_metadata_v3' do
let(:github_output) { Tempfile.new('github_output') }
let(:github_output_content) { github_output.read }
let(:github_repository_owner) { nil }
before do
ENV['GITHUB_ACTIONS'] = '1'
ENV['GITHUB_OUTPUT'] = g... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | spec/exe/matrix_from_metadata_v2_spec.rb | Ruby | apache-2.0 | 88 | main | 7,408 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'matrix_from_metadata_v2' do
context 'without arguments' do
let(:github_output) { Tempfile.new('github_output') }
let(:github_output_content) { github_output.read }
let(:result) { run_matrix_from_metadata_v2 }
before do
ENV['G... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | spec/lib/puppet_litmus/rake_helper_spec.rb | Ruby | apache-2.0 | 88 | main | 12,412 | # frozen_string_literal: true
require 'spec_helper'
RSpec.shared_examples 'supported provisioner' do |args|
let(:provisioner) { args[:provisioner] }
let(:platform) { args[:platform] }
let(:inventory_vars) { args[:inventory_vars] }
let(:provision_hash) { args[:provision_hash] }
let(:results) { args[:results]... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | spec/lib/puppet_litmus/rake_tasks_spec.rb | Ruby | apache-2.0 | 88 | main | 8,170 | # frozen_string_literal: true
require 'spec_helper'
describe 'litmus rake tasks' do
before(:all) do # rubocop:disable RSpec/BeforeAfterAll
load File.expand_path('../../../lib/puppet_litmus/rake_tasks.rb', __dir__)
# the spec_prep task is stubbed, rather than load from another gem.
Rake::Task.define_task... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | spec/lib/puppet_litmus/puppet_litmus_version_spec.rb | Ruby | apache-2.0 | 88 | main | 230 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe PuppetLitmus do
it 'has a version number' do
expect(described_class::VERSION).not_to be_nil
expect(described_class::VERSION).to be_a(String)
end
end |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | spec/lib/puppet_litmus/util_spec.rb | Ruby | apache-2.0 | 88 | main | 580 | # frozen_string_literal: true
require 'spec_helper'
load File.expand_path('../../../lib/puppet_litmus/util.rb', __dir__)
RSpec.describe PuppetLitmus::Util do
context 'when using interpolate_powershell' do
let(:command) { 'foo' }
let(:encoded) { Base64.strict_encode64(command.encode('UTF-16LE')) }
it 'i... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | spec/lib/puppet_litmus/puppet_helpers_spec.rb | Ruby | apache-2.0 | 88 | main | 20,816 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe PuppetLitmus::PuppetHelpers do
let(:inventory_hash) { { 'groups' => [{ 'name' => 'local', 'targets' => [{ 'uri' => 'some.host', 'config' => { 'transport' => 'local' }, 'facts' => facts_hash }] }] } }
let(:localhost_inventory_hash) { { 'groups' => ... |
github | puppetlabs/puppet_litmus | https://github.com/puppetlabs/puppet_litmus | spec/lib/puppet_litmus/inventory_manipulation_spec.rb | Ruby | apache-2.0 | 88 | main | 8,590 | # frozen_string_literal: true
require 'spec_helper'
require 'support/inventory'
RSpec.describe PuppetLitmus::InventoryManipulation do
let(:inventory_full_path) { 'spec/data/inventory.yaml' }
context 'with config_from_node' do
it 'no matching node, returns nil' do
expect(config_from_node(config_hash, 'n... |
github | petebrowne/sprockets-sass | https://github.com/petebrowne/sprockets-sass | sprockets-sass.gemspec | Ruby | mit | 88 | master | 2,256 | # -*- encoding: utf-8 -*-
# frozen_string_literal: true
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
require 'sprockets/sass/version'
Gem::Specification.new do |s|
s.name = 'sprockets-sass'
s.version = Sprockets::Sass::VERSION
s.authors = ['Pete Browne']
s.email = ['me@petebrowne.c... |
github | petebrowne/sprockets-sass | https://github.com/petebrowne/sprockets-sass | Rakefile | Ruby | mit | 88 | master | 436 | require 'bundler/setup'
require 'bundler/gem_tasks'
require 'appraisal'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.rspec_opts = ['--backtrace '] if ENV['DEBUG']
spec.verbose = true
end
desc 'Default: run the unit tests.'
task default: [:all]
desc 'Test the plugin under all su... |
github | petebrowne/sprockets-sass | https://github.com/petebrowne/sprockets-sass | Appraisals | Ruby | mit | 88 | master | 1,753 | appraise 'sprockets_2.2' do
gem 'sprockets', '~> 2.2.0'
gem 'sass', '~> 3.2.0'
gem 'compass', '~> 0.12.0'
end
appraise 'sprockets_2.3' do
gem 'sprockets', '~> 2.3.0'
gem 'sass', '~> 3.2.0'
gem 'compass', '~> 0.12.0'
end
appraise 'sprockets_2.4' do
gem 'sprockets', '~> 2.4.0'
gem 'sass', '~> 3.2.0'
g... |
github | petebrowne/sprockets-sass | https://github.com/petebrowne/sprockets-sass | lib/sprockets/sass.rb | Ruby | mit | 88 | master | 1,833 | # frozen_string_literal: true
require 'sprockets'
require 'sprockets/sass/version'
require 'sprockets/sass/utils'
require 'sprockets/sass/registration'
require 'sass'
require 'sass/importers/base'
require 'json'
require 'pathname'
# the module of Sprockets
module Sprockets
# The internal Sass module used to load a... |
github | petebrowne/sprockets-sass | https://github.com/petebrowne/sprockets-sass | lib/sprockets/sass/registration.rb | Ruby | mit | 88 | master | 4,419 | # frozen_string_literal: true
module Sprockets
module Sass
# class useful for registering engines, tranformers, preprocessors and conpressors for sprockets
# depending on the version of sprockets
class Registration
attr_reader :klass, :sprockets_version, :registration_instance
def initialize(... |
github | petebrowne/sprockets-sass | https://github.com/petebrowne/sprockets-sass | lib/sprockets/sass/utils.rb | Ruby | mit | 88 | master | 3,875 | # frozen_string_literal: true
module Sprockets
module Sass
# utility functions that can be used statically from anywhere
class Utils
class << self
def full_version_of_sprockets
Sprockets::VERSION
end
def version_of_sprockets
full_version_of_sprockets.split('.... |
github | petebrowne/sprockets-sass | https://github.com/petebrowne/sprockets-sass | lib/sprockets/sass/functions.rb | Ruby | mit | 88 | master | 1,175 | # frozen_string_literal: true
module Sass
module Script
# Original Sass script functions are overidden with this methods
module Functions
include Sprockets::Sass::Utils.get_class_by_version('Functions')
# Hack to ensure previous API declarations (by Compass or whatever)
# don't take precede... |
github | petebrowne/sprockets-sass | https://github.com/petebrowne/sprockets-sass | lib/sprockets/sass/v3/scss_template.rb | Ruby | mit | 88 | master | 341 | # frozen_string_literal: true
require_relative './sass_template'
module Sprockets
module Sass
module V3
# Preprocessor for SCSS files
class ScssTemplate < Sprockets::Sass::V3::SassTemplate
# Define the expected syntax for the template
def self.syntax
:scss
end
e... |
github | petebrowne/sprockets-sass | https://github.com/petebrowne/sprockets-sass | lib/sprockets/sass/v3/compressor.rb | Ruby | mit | 88 | master | 2,938 | # frozen_string_literal: true
module Sprockets
module Sass
module V3
# Class used to compress CSS files
class Compressor
VERSION = '1'
def self.default_mime_type
'text/css'
end
# Public: Return singleton instance with default options.
#
# Re... |
github | petebrowne/sprockets-sass | https://github.com/petebrowne/sprockets-sass | lib/sprockets/sass/v3/importer.rb | Ruby | mit | 88 | master | 8,919 | # frozen_string_literal: true
require_relative '../v2/importer'
module Sprockets
module Sass
module V3
# class used for importing files from SCCS and SASS files
class Importer < Sprockets::Sass::V2::Importer
GLOB = /\*|\[.+\]/
protected
def resolve_path_with_load_paths(contex... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.