Module: Hone::Patterns
- Defined in:
- lib/hone/patterns/base.rb,
lib/hone/patterns/divmod.rb,
lib/hone/patterns/uniq_by.rb,
lib/hone/patterns/lazy_ivar.rb,
lib/hone/patterns/sort_last.rb,
lib/hone/patterns/times_map.rb,
lib/hone/patterns/gsub_to_tr.rb,
lib/hone/patterns/inject_sum.rb,
lib/hone/patterns/select_map.rb,
lib/hone/patterns/sort_first.rb,
lib/hone/patterns/kernel_loop.rb,
lib/hone/patterns/map_compact.rb,
lib/hone/patterns/map_flatten.rb,
lib/hone/patterns/dynamic_ivar.rb,
lib/hone/patterns/flatten_once.rb,
lib/hone/patterns/regexp_match.rb,
lib/hone/patterns/reverse_each.rb,
lib/hone/patterns/select_count.rb,
lib/hone/patterns/select_first.rb,
lib/hone/patterns/sort_by_last.rb,
lib/hone/patterns/sort_reverse.rb,
lib/hone/patterns/string_empty.rb,
lib/hone/patterns/array_compact.rb,
lib/hone/patterns/block_to_proc.rb,
lib/hone/patterns/chars_map_ord.rb,
lib/hone/patterns/count_vs_size.rb,
lib/hone/patterns/hash_each_key.rb,
lib/hone/patterns/range_include.rb,
lib/hone/patterns/reverse_first.rb,
lib/hone/patterns/shuffle_first.rb,
lib/hone/patterns/sort_by_first.rb,
lib/hone/patterns/string_shovel.rb,
lib/hone/patterns/string_casecmp.rb,
lib/hone/patterns/yield_vs_block.rb,
lib/hone/patterns/bsearch_vs_find.rb,
lib/hone/patterns/constant_regexp.rb,
lib/hone/patterns/each_with_index.rb,
lib/hone/patterns/hash_each_value.rb,
lib/hone/patterns/hash_merge_bang.rb,
lib/hone/patterns/string_end_with.rb,
lib/hone/patterns/dynamic_ivar_get.rb,
lib/hone/patterns/each_with_object.rb,
lib/hone/patterns/map_select_chain.rb,
lib/hone/patterns/array_include_set.rb,
lib/hone/patterns/chars_to_variable.rb,
lib/hone/patterns/hash_keys_include.rb,
lib/hone/patterns/slice_with_length.rb,
lib/hone/patterns/string_chars_each.rb,
lib/hone/patterns/string_start_with.rb,
lib/hone/patterns/positive_predicate.rb,
lib/hone/patterns/hash_values_include.rb,
lib/hone/patterns/parallel_assignment.rb,
lib/hone/patterns/taint_tracking_base.rb,
lib/hone/patterns/string_delete_prefix.rb,
lib/hone/patterns/string_delete_suffix.rb,
lib/hone/patterns/string_concat_in_loop.rb,
lib/hone/patterns/redundant_string_chars.rb,
lib/hone/patterns/chars_to_variable_tainted.rb
Overview
Pattern matchers for detecting optimization opportunities in Ruby AST.
Each pattern class inherits from Base and implements visit_* methods to detect specific anti-patterns using Prism's visitor interface.
Defined Under Namespace
Classes: ArrayCompact, ArrayIncludeSet, Base, BlockToProc, BsearchVsFind, CharsMapOrd, CharsToVariable, CharsToVariableTainted, ConstantRegexp, CountVsSize, Divmod, DynamicIvar, DynamicIvarGet, EachWithIndex, EachWithObject, FlattenOnce, GsubToTr, HashEachKey, HashEachValue, HashKeysInclude, HashMergeBang, HashValuesInclude, InjectSum, KernelLoop, LazyIvar, MapCompact, MapFlatten, MapSelectChain, ParallelAssignment, PositivePredicate, RangeInclude, RedundantStringChars, RegexpMatch, ReverseEach, ReverseFirst, SelectCount, SelectFirst, SelectMap, ShuffleFirst, SliceWithLength, SortByFirst, SortByLast, SortFirst, SortLast, SortReverse, StringCasecmp, StringCharsEach, StringConcatInLoop, StringDeletePrefix, StringDeleteSuffix, StringEmpty, StringEndWith, StringShovel, StringStartWith, TaintTrackingBase, TimesMap, UniqBy, YieldVsBlock
Class Attribute Summary collapse
-
.registered ⇒ Object
readonly
Returns the value of attribute registered.
Class Method Summary collapse
Class Attribute Details
.registered ⇒ Object (readonly)
Returns the value of attribute registered.
25 26 27 |
# File 'lib/hone/patterns/base.rb', line 25 def registered @registered end |
Class Method Details
.register(pattern_class) ⇒ Object
27 28 29 |
# File 'lib/hone/patterns/base.rb', line 27 def register(pattern_class) @registered << pattern_class end |