Class: ActiveResourceInspector::Base
- Inherits:
-
Object
- Object
- ActiveResourceInspector::Base
- Defined in:
- lib/active_resource_inspector.rb
Instance Attribute Summary collapse
-
#dirname ⇒ Object
Returns the value of attribute dirname.
-
#resources ⇒ Object
readonly
Returns the value of attribute resources.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#dirname ⇒ Object
Returns the value of attribute dirname.
8 9 10 |
# File 'lib/active_resource_inspector.rb', line 8 def dirname @dirname end |
#resources ⇒ Object (readonly)
Returns the value of attribute resources.
7 8 9 |
# File 'lib/active_resource_inspector.rb', line 7 def resources @resources end |
Class Method Details
.detailed_print ⇒ Object
31 32 33 34 35 |
# File 'lib/active_resource_inspector.rb', line 31 def self.detailed_print factory(dirpath).defaul_print do |res| ["\t"*5, res.prefix_source, res.collection_name, res.format_extension, " (", res, ") \n\n"].join('') end end |
.print(dirpath) ⇒ Object
27 28 29 |
# File 'lib/active_resource_inspector.rb', line 27 def self.print(dirpath) factory(dirpath).defaul_print end |
Instance Method Details
#defaul_print(&block) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/active_resource_inspector.rb', line 37 def defaul_print(&block) puts "Location: #{dirname}" puts "\n" resources.group_by{|e| e.site.to_s }.each do |endpoint, rs| rs.group_by{|e| e.auth_type }.each do |auth_type, rs2| if auth_type.nil? puts "#{endpoint} #{rs2[0].headers.empty? ? '(no auth)' : 'with headers auth '+rs2[0].headers.to_s }" else puts "#{endpoint} wiht auth #{auth_type.capitalize}" end t = rs2.map do |res| if block_given? block.call(res) else ["\t"*5, res.prefix_source, res.collection_name, res.format_extension].join('') end end puts t.sort end end end |
#files ⇒ Object
23 24 25 |
# File 'lib/active_resource_inspector.rb', line 23 def files Dir[File.join(dirname, '**/*.rb')] end |