Class: HadoopDsl::LogAnalysis::LogAnalysisMapperModel

Inherits:
BaseMapperModel show all
Defined in:
lib/log_analysis.rb

Overview

model

Defined Under Namespace

Classes: Column, ColumnArray, Topic

Instance Attribute Summary collapse

Attributes inherited from BaseMapperModel

#key, #value

Attributes inherited from BaseModel

#controller

Instance Method Summary collapse

Methods included from DslElement

#method_missing

Constructor Details

#initialize(key, value) ⇒ LogAnalysisMapperModel

Returns a new instance of LogAnalysisMapperModel.



129
130
131
132
133
# File 'lib/log_analysis.rb', line 129

def initialize(key, value)
  super(key, value)
  @columns = ColumnArray.new
  @topics = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class HadoopDsl::DslElement

Instance Attribute Details

#current_topicObject (readonly)

Returns the value of attribute current_topic.



127
128
129
# File 'lib/log_analysis.rb', line 127

def current_topic
  @current_topic
end

Instance Method Details

#columnObject



135
# File 'lib/log_analysis.rb', line 135

def column; @columns end

#create_or_replace_columns_with(array, &block) ⇒ Object



141
142
143
144
145
146
147
148
# File 'lib/log_analysis.rb', line 141

def create_or_replace_columns_with(array, &block)
  columns = array.enum_for(:each_with_index).map do |p, i|
    c = @columns[i] ? @columns[i] : Column.new(i)
    yield c, p
    c
  end
  @columns = ColumnArray.new(columns)
end

#create_topic(desc, options) ⇒ Object



137
138
139
# File 'lib/log_analysis.rb', line 137

def create_topic(desc, options)
  @topics << @current_topic = Topic.new(desc, options[:label])
end