class One9::ReportMethod

Constants

CURRENT_DIRS
CURRENT_DIRS_REGEX

Attributes

allowed_paths[RW]
regexp_paths[RW]
report_paths[RW]
stacks[RW]

Public Class Methods

create(meths, stacks) click to toggle source
# File lib/one9/report_method.rb, line 9
def self.create(meths, stacks)
  self.stacks = stacks
  self.allowed_paths += ['app/', 'config/'] if File.exists? 'config/environment.rb'
  self.report_paths = CURRENT_DIRS.map {|e| allowed_paths.map {|f| e + f } }.flatten
  self.regexp_paths = Regexp.new "^#{Regexp.union(report_paths)}"
  meths.map {|e| new(e) }
end
new(meth) click to toggle source
# File lib/one9/report_method.rb, line 17
def initialize(meth)
  @meth = meth
end

Public Instance Methods

count() click to toggle source
# File lib/one9/report_method.rb, line 30
def count
  stacks.count
end
report_stack(ary) click to toggle source
# File lib/one9/report_method.rb, line 34
def report_stack(ary)
  One9.config[:all] || ary[0][self.class.regexp_paths] ? ary[0] : nil
end
stacks() click to toggle source
# File lib/one9/report_method.rb, line 25
def stacks
  @stacks ||= Array(self.class.stacks[name]).map {|e| report_stack(e) }.
    compact.map {|e| e.sub(CURRENT_DIRS_REGEX, '') }.uniq
end