Class: Snortor::Rulefile
- Inherits:
-
Array
- Object
- Array
- Snortor::Rulefile
- Defined in:
- lib/rulefile.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#filepath ⇒ Object
Returns the value of attribute filepath.
-
#relative_path ⇒ Object
Returns the value of attribute relative_path.
Instance Method Summary collapse
- #calc_relative_path(fullpath) ⇒ Object
-
#initialize(filepath) ⇒ Rulefile
constructor
A new instance of Rulefile.
Constructor Details
#initialize(filepath) ⇒ Rulefile
Returns a new instance of Rulefile.
7 8 9 10 11 |
# File 'lib/rulefile.rb', line 7 def initialize(filepath) raise Errno::ENOENT unless File.exists?(filepath) @filepath = filepath @filename = File.basename(filepath) end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
3 4 5 |
# File 'lib/rulefile.rb', line 3 def filename @filename end |
#filepath ⇒ Object
Returns the value of attribute filepath.
4 5 6 |
# File 'lib/rulefile.rb', line 4 def filepath @filepath end |
#relative_path ⇒ Object
Returns the value of attribute relative_path.
5 6 7 |
# File 'lib/rulefile.rb', line 5 def relative_path @relative_path end |
Instance Method Details
#calc_relative_path(fullpath) ⇒ Object
13 14 15 16 17 |
# File 'lib/rulefile.rb', line 13 def calc_relative_path(fullpath) workingdir = fullpath.split("/") thispath = @filepath.split("/") @relative_path = (thispath-workingdir-[filename]).join("/") end |