Class: Wikirate4ruby::Entities::Metric
- Defined in:
- lib/wikirate4ruby/entities/metric.rb
Constant Summary collapse
- ATTRIBUTES =
i[metric_name metric_designer metric_type question about methodology value_type report_type research_policy unit range hybrid topics scores formula rubric variables answers bookmarkers datasets companies calculations answers_url].freeze
Constants inherited from Card
Instance Method Summary collapse
-
#initialize(metric) ⇒ Metric
constructor
A new instance of Metric.
Methods inherited from Card
#as_json, #raw_json, #to_json, #to_s
Constructor Details
#initialize(metric) ⇒ Metric
Returns a new instance of Metric.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/wikirate4ruby/entities/metric.rb', line 11 def initialize(metric) super metric raise parsing_error name = "IncompatibleCardType", = "The input Card is not a Metric but a #{@type}" if @type != 'Metric' @metric_name = @data['title'] @metric_designer = @data['designer'] @metric_type = get_content 'metric_type' @question = get_content 'question' @about = get_content 'about' @methodology = get_content 'methodology' = get_content 'value_options' @value_type = get_content 'value_type' @report_type = get_content 'report_type' @research_policy = get_content 'research_policy' @unit = get_content 'unit' @range = get_content 'range' @hybrid = get_content 'hybrid' @topics = get_content 'topics' @scores = get_content 'scores' @formula = get_content 'formula' @rubric = get_content 'rubric' @variables = get_content 'variables' @answers = get_content 'answers' @bookmarkers = get_content 'bookmarkers' @datasets = get_content 'datasets' @companies = get_content 'companies' @calculations = get_content 'calculations' @answers_url = get_content 'answers_url' end |