Class: Fluoride::Analyzer::PatternContext
- Inherits:
-
Object
- Object
- Fluoride::Analyzer::PatternContext
- Defined in:
- lib/fluoride-analyzer/pattern-context.rb
Instance Attribute Summary collapse
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
- #context_binding ⇒ Object
- #each_status_group ⇒ Object
- #filename ⇒ Object
-
#initialize(pattern, methods_hash) ⇒ PatternContext
constructor
A new instance of PatternContext.
- #param_fields ⇒ Object
Constructor Details
#initialize(pattern, methods_hash) ⇒ PatternContext
Returns a new instance of PatternContext.
6 7 8 9 |
# File 'lib/fluoride-analyzer/pattern-context.rb', line 6 def initialize(pattern, methods_hash) @pattern, @methods_hash = pattern, methods_hash @collapser = PatternCollapser.new(pattern, methods_hash) end |
Instance Attribute Details
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
10 11 12 |
# File 'lib/fluoride-analyzer/pattern-context.rb', line 10 def pattern @pattern end |
Instance Method Details
#context_binding ⇒ Object
30 31 32 |
# File 'lib/fluoride-analyzer/pattern-context.rb', line 30 def context_binding binding end |
#each_status_group ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/fluoride-analyzer/pattern-context.rb', line 12 def each_status_group @methods_hash.each_pair do |method, hash| hash.each_pair do |status, requests| GroupCollapser.new(@collapser.pattern, @collapser.param_letname_map, method, status, requests).each_group_context do |context| yield context end end end end |
#filename ⇒ Object
26 27 28 |
# File 'lib/fluoride-analyzer/pattern-context.rb', line 26 def filename @collapser.pattern.gsub(%r{[:/().]+},'_').gsub(/^_|_$/, '') + "_spec.rb" end |
#param_fields ⇒ Object
22 23 24 |
# File 'lib/fluoride-analyzer/pattern-context.rb', line 22 def param_fields @collapser.params_fields end |