Class: HadoopDsl::LogAnalysis::LogAnalysisMapperModel::Topic
- Inherits:
-
Object
- Object
- HadoopDsl::LogAnalysis::LogAnalysisMapperModel::Topic
- Defined in:
- lib/log_analysis.rb
Instance Attribute Summary collapse
-
#key_elements ⇒ Object
readonly
Returns the value of attribute key_elements.
Instance Method Summary collapse
-
#initialize(desc, label = nil) ⇒ Topic
constructor
A new instance of Topic.
- #key ⇒ Object
- #label ⇒ Object
Constructor Details
#initialize(desc, label = nil) ⇒ Topic
Returns a new instance of Topic.
172 173 174 175 |
# File 'lib/log_analysis.rb', line 172 def initialize(desc, label = nil) @desc, @label = desc, label @key_elements = [] end |
Instance Attribute Details
#key_elements ⇒ Object (readonly)
Returns the value of attribute key_elements.
170 171 172 |
# File 'lib/log_analysis.rb', line 170 def key_elements @key_elements end |
Instance Method Details
#key ⇒ Object
181 182 183 184 185 |
# File 'lib/log_analysis.rb', line 181 def key without_label = @key_elements.size > 0 ? @key_elements.join(KEY_SEP) : nil [label, without_label].compact.join(KEY_SEP) end |
#label ⇒ Object
177 178 179 |
# File 'lib/log_analysis.rb', line 177 def label @label || @desc.gsub(/\s/, '_') end |