Sha256: 8943a95e9895c6d4591e3f511a41198743a5ed46889019878fb2ef3db2f2ce10
Contents?: true
Size: 1.02 KB
Versions: 7
Compression:
Stored size: 1.02 KB
Contents
class Lbrt::Space::DSL::Context::Space::Chart::Stream include Lbrt::Utils::TemplateHelper REQUIRED_ATTRIBUTES = %w( metric type source group_function summary_function ) def initialize(context, space_name_or_id, chart_name_or_id, &block) @context = context.dup @space_name_or_id = space_name_or_id @chart_name_or_id = chart_name_or_id @result = {} instance_eval(&block) end attr_reader :context def result REQUIRED_ATTRIBUTES.each do |name| unless @result.has_key?(name) raise "Space `#{@space_name_or_id}` > Chart `#{@chart_name_or_id}` > Stream > `#{name}` is not defined" end end @result end private def metric(value) @result['metric'] = value.to_s end def type(value) @result['type'] = value.to_s end def source(value) @result['source'] = value.to_s end def group_function(value) @result['group_function'] = value.to_s end def summary_function(value) @result['summary_function'] = value.to_s end end
Version data entries
7 entries across 7 versions & 1 rubygems