Module: Bri
- Defined in:
- lib/bri.rb,
lib/bri/mall.rb,
lib/bri/matcher.rb,
lib/bri/renderer.rb,
lib/bri/templates.rb,
lib/bri/match/base.rb,
lib/bri/match/class.rb,
lib/bri/search/base.rb,
lib/bri/match/method.rb,
lib/bri/search/class.rb,
lib/bri/search/method.rb,
lib/bri/search/class_method.rb,
lib/bri/search/instance_method.rb
Defined Under Namespace
Modules: Match, Renderer, Search, Templates
Classes: Mall, Matcher
Constant Summary
collapse
- DEFAULT_WIDTH =
72
Class Method Summary
collapse
Class Method Details
.list_classes ⇒ Object
42
43
44
|
# File 'lib/bri.rb', line 42
def self.list_classes
Bri::Mall.instance.classes.join("\n" )
end
|
.list_methods ⇒ Object
46
47
48
49
|
# File 'lib/bri.rb', line 46
def self.list_methods
( Bri::Mall.instance.instance_methods +
Bri::Mall.instance.class_methods ).sort.join( "\n" )
end
|
.list_names ⇒ Object
51
52
53
54
55
|
# File 'lib/bri.rb', line 51
def self.list_names
( Bri::Mall.instance.classes +
Bri::Mall.instance.instance_methods +
Bri::Mall.instance.class_methods ).sort.join( "\n" )
end
|
.ri(query) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/bri.rb', line 14
def self.ri( query )
results = Bri::Matcher.new( query ).find
if results.size == 0
"No matching results found"
elsif results.size == 1
results.first.to_s
elsif results.all? { |r| r.is_a?(Bri::Match::Class) }
results.map(&:to_s)
else
qualified_methods = results.map(&:full_name).sort
ERB.new( Bri::Templates::MULTIPLE_CHOICES, nil, '<>' ).result( binding )
end
end
|
.width ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/bri.rb', line 29
def self.width
return @width if instance_variable_defined?( :@width )
base_width = ENV['COLUMNS'].to_i
base_width = 80 if base_width == 0
@width ||= [ base_width - 8, 1 ].max
end
|
.width=(width) ⇒ Object
38
39
40
|
# File 'lib/bri.rb', line 38
def self.width=( width )
@width = [ width, 1 ].max
end
|