Class: Magika::FileType
- Inherits:
-
Object
- Object
- Magika::FileType
- Defined in:
- lib/magika.rb
Constant Summary collapse
- CONTENT_TYPES_PATH =
File.join(ASSETS_DIR, "content_types_kb.min.json")
- CONTENT_TYPES =
JSON.load_file(CONTENT_TYPES_PATH, symbolize_names: true)
- MEDIUM_CONFIDENCE_THRESHOLD =
- THRESHOLDS =
Instance Attribute Summary collapse
-
#score ⇒ Object
readonly
Returns the value of attribute score.
Instance Method Summary collapse
-
#initialize(label, score) ⇒ FileType
constructor
A new instance of FileType.
- #inspect ⇒ Object
- #label ⇒ Object
- #text? ⇒ Boolean
Constructor Details
#initialize(label, score) ⇒ FileType
Returns a new instance of FileType.
121 122 123 124 125 126 |
# File 'lib/magika.rb', line 121 def initialize(label, score) @inferred_label = label @score = score @overwritten = nil @content_type = nil end |
Instance Attribute Details
#score ⇒ Object (readonly)
Returns the value of attribute score.
119 120 121 |
# File 'lib/magika.rb', line 119 def score @score end |
Instance Method Details
#inspect ⇒ Object
143 144 145 |
# File 'lib/magika.rb', line 143 def inspect "#<#{self.class} label=#{label} score=#{score} #{mime_type} #{description.dump} (#{group})>" end |
#label ⇒ Object
128 129 130 131 |
# File 'lib/magika.rb', line 128 def label content_type @overwritten || @inferred_label end |
#text? ⇒ Boolean
139 140 141 |
# File 'lib/magika.rb', line 139 def text? content_type[:is_text] end |