Class: Sekisyo::Whitelist
- Inherits:
-
Object
- Object
- Sekisyo::Whitelist
- Defined in:
- lib/sekisyo/whitelist.rb
Overview
Sekisyo Whitelist parses the yaml file and assists in finding the corresponding whitelist.
Instance Method Summary collapse
- #find(path) ⇒ Sekisyo::WhitelistDetails::Path
-
#parse(*file_paths) ⇒ Object
Reads the yaml file containing the whitelist definition and converts it to a Ruby object.
Instance Method Details
#find(path) ⇒ Sekisyo::WhitelistDetails::Path
30 31 32 |
# File 'lib/sekisyo/whitelist.rb', line 30 def find(path) @paths.find { |pattern| pattern.match?(path) } end |
#parse(*file_paths) ⇒ Object
Reads the yaml file containing the whitelist definition and converts it to a Ruby object.
17 18 19 20 21 22 23 |
# File 'lib/sekisyo/whitelist.rb', line 17 def parse(*file_paths) @hash = Hashie::Mash.new.deep_merge(*file_paths.map(&Hashie::Mash.method(:load))) @paths = @hash['paths'].map do |path, object| Sekisyo::WhitelistDetails::Path.new(path, object) end self end |