Module: Parlour::Mixin::Searchable
- Extended by:
- T::Generic, T::Sig
- Included in:
- RbiGenerator::Namespace, RbsGenerator::Namespace
- Defined in:
- lib/parlour/mixin/searchable.rb
Overview
Extends a particular type system’s Namespace class to provide searchable children.
Constant Summary collapse
- Child =
type_member {{ upper: TypedObject }}
Instance Method Summary collapse
- #children ⇒ Object
-
#find(name: nil, type: nil) ⇒ Object
Finds the first child matching the given predicates.
-
#find_all(name: nil, type: nil) ⇒ Object
Finds the first child matching the given predicates.
Instance Method Details
#children ⇒ Object
16 |
# File 'lib/parlour/mixin/searchable.rb', line 16 def children; end |
#find(name: nil, type: nil) ⇒ Object
Finds the first child matching the given predicates.
24 25 26 |
# File 'lib/parlour/mixin/searchable.rb', line 24 def find(name: nil, type: nil) T.unsafe(children).find { |c| searchable_child_matches(c, name, type) } end |
#find_all(name: nil, type: nil) ⇒ Object
Finds the first child matching the given predicates.
34 35 36 |
# File 'lib/parlour/mixin/searchable.rb', line 34 def find_all(name: nil, type: nil) T.unsafe(children).select { |c| searchable_child_matches(c, name, type) } end |