Class: Alchemy::Ingredients::NumberView

Inherits:
BaseView
  • Object
show all
Defined in:
app/components/alchemy/ingredients/number_view.rb

Instance Attribute Summary

Attributes inherited from BaseView

#html_options, #ingredient

Instance Method Summary collapse

Methods inherited from BaseView

#render?

Constructor Details

#initialize(ingredient, options = {}) ⇒ NumberView

Returns a new instance of NumberView.



4
5
6
7
8
9
10
11
# File 'app/components/alchemy/ingredients/number_view.rb', line 4

def initialize(ingredient, options = {})
  super(ingredient)
  @options = {
    units: {
      unit: settings_value(:unit, value: options[:unit])
    }.merge(options[:units] || {})
  }
end

Instance Method Details

#callObject



13
14
15
# File 'app/components/alchemy/ingredients/number_view.rb', line 13

def call
  number_to_human(value, @options)
end