Class: One9::ReportMethod
- Inherits:
-
Object
- Object
- One9::ReportMethod
- Defined in:
- lib/one9/report_method.rb
Constant Summary collapse
- CURRENT_DIRS =
[Dir.pwd + '/', './']
- CURRENT_DIRS_REGEX =
Regexp.new "^#{Regexp.union(CURRENT_DIRS)}"
Class Attribute Summary collapse
-
.allowed_paths ⇒ Object
Returns the value of attribute allowed_paths.
-
.regexp_paths ⇒ Object
Returns the value of attribute regexp_paths.
-
.report_paths ⇒ Object
Returns the value of attribute report_paths.
-
.stacks ⇒ Object
Returns the value of attribute stacks.
Class Method Summary collapse
Instance Method Summary collapse
- #count ⇒ Object
-
#initialize(meth) ⇒ ReportMethod
constructor
A new instance of ReportMethod.
- #report_stack(ary) ⇒ Object
- #stacks ⇒ Object
Constructor Details
#initialize(meth) ⇒ ReportMethod
Returns a new instance of ReportMethod.
17 18 19 |
# File 'lib/one9/report_method.rb', line 17 def initialize(meth) @meth = meth end |
Class Attribute Details
.allowed_paths ⇒ Object
Returns the value of attribute allowed_paths.
6 7 8 |
# File 'lib/one9/report_method.rb', line 6 def allowed_paths @allowed_paths end |
.regexp_paths ⇒ Object
Returns the value of attribute regexp_paths.
6 7 8 |
# File 'lib/one9/report_method.rb', line 6 def regexp_paths @regexp_paths end |
.report_paths ⇒ Object
Returns the value of attribute report_paths.
6 7 8 |
# File 'lib/one9/report_method.rb', line 6 def report_paths @report_paths end |
.stacks ⇒ Object
Returns the value of attribute stacks.
6 7 8 |
# File 'lib/one9/report_method.rb', line 6 def stacks @stacks end |
Class Method Details
.create(meths, stacks) ⇒ Object
9 10 11 12 13 14 15 |
# 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 |
Instance Method Details
#count ⇒ Object
30 31 32 |
# File 'lib/one9/report_method.rb', line 30 def count stacks.count end |
#report_stack(ary) ⇒ Object
34 35 36 |
# 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 ⇒ Object
25 26 27 28 |
# 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 |