module Yari
Constants
- VERSION
Attributes
features[RW]
Public Instance Methods
feature?(path)
click to toggle source
# File lib/yari.rb, line 21 def feature?(path) !!path.match(mask_to_pattern(feature_mask)) end
feature_spec?(path)
click to toggle source
# File lib/yari.rb, line 25 def feature_spec?(path) !!path.match(mask_to_pattern(spec_mask)) end
feature_to_spec(path, prefix = true)
click to toggle source
# File lib/yari.rb, line 29 def feature_to_spec(path, prefix = true) path = path.match(mask_to_pattern(feature_mask))[0] unless prefix path.sub(mask_to_pattern(feature_mask), mask_to_replacement(spec_mask)) end
spec_to_feature(path, prefix = true)
click to toggle source
# File lib/yari.rb, line 34 def spec_to_feature(path, prefix = true) path = path.match(mask_to_pattern(spec_mask))[0] unless prefix path.sub(mask_to_pattern(spec_mask), mask_to_replacement(feature_mask)) end
Protected Instance Methods
feature_mask()
click to toggle source
# File lib/yari.rb, line 45 def feature_mask ::RSpec.configuration.feature_mapping[:feature] end
mask_to_pattern(mask)
click to toggle source
# File lib/yari.rb, line 49 def mask_to_pattern(mask) Regexp.new("#{Regexp.escape(mask).sub("\\*\\*/\\*", '(.+)')}$") end
mask_to_replacement(mask)
click to toggle source
# File lib/yari.rb, line 53 def mask_to_replacement(mask) "#{mask.sub('**/*') { '\\1' }}" end
spec_mask()
click to toggle source
# File lib/yari.rb, line 41 def spec_mask ::RSpec.configuration.feature_mapping[:spec] end