Class: Codesake::Engine::Text
- Inherits:
-
Object
- Object
- Codesake::Engine::Text
- Includes:
- Core, Utils::Files, Utils::Secrets
- Defined in:
- lib/codesake/engine/text.rb
Constant Summary
Constants included from Utils::Secrets
Utils::Secrets::DEFAULT_SECRETS
Instance Attribute Summary collapse
-
#reserved_keywords ⇒ Object
readonly
Returns the value of attribute reserved_keywords.
Attributes included from Utils::Secrets
Attributes included from Utils::Files
Class Method Summary collapse
Instance Method Summary collapse
- #analyse ⇒ Object
-
#initialize(filename) ⇒ Text
constructor
A new instance of Text.
Methods included from Utils::Secrets
#add, #find_reserved_keywords, #load_secrets, #reserved?
Methods included from Utils::Files
#lines, #lines_of_comment, #loc, #read_file
Constructor Details
#initialize(filename) ⇒ Text
Returns a new instance of Text.
12 13 14 15 16 17 18 |
# File 'lib/codesake/engine/text.rb', line 12 def initialize(filename) @filename = filename @raw_results = nil read_file load_secrets end |
Instance Attribute Details
#reserved_keywords ⇒ Object (readonly)
Returns the value of attribute reserved_keywords.
10 11 12 |
# File 'lib/codesake/engine/text.rb', line 10 def reserved_keywords @reserved_keywords end |
Class Method Details
.is_txt?(filename) ⇒ Boolean
30 31 32 |
# File 'lib/codesake/engine/text.rb', line 30 def self.is_txt?(filename) (File.extname(filename).empty? or File.extname(filename) == ".txt" or File.extname(filename) == ".conf" or File.extname(filename) == ".rc" or File.extname(filename) == ".bak" or File.extname(filename) == ".old" ) end |
Instance Method Details
#analyse ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/codesake/engine/text.rb', line 20 def analyse ret = [] @reserved_keywords = find_reserved_keywords @reserved_keywords.each do |secret| ret << "reserved keyword found: \"#{secret[:matcher]}\" (#{@filename}@#{secret[:line]})" end ret end |