Class: Input::FileComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Input::FileComponent
- Defined in:
- lib/app/components/input/file_component.rb
Instance Method Summary collapse
-
#initialize(item:, field:, form:, variant: nil) ⇒ FileComponent
constructor
A new instance of FileComponent.
- #label ⇒ Object
- #object ⇒ Object
- #picture ⇒ Object
Constructor Details
#initialize(item:, field:, form:, variant: nil) ⇒ FileComponent
Returns a new instance of FileComponent.
5 6 7 8 9 10 11 12 13 |
# File 'lib/app/components/input/file_component.rb', line 5 def initialize(item:, field:, form:, variant: nil) @item = item @field = field @form = form @label = label @variant = variant @picture = picture @object = object end |
Instance Method Details
#label ⇒ Object
15 16 17 |
# File 'lib/app/components/input/file_component.rb', line 15 def label I18n.t("#{@item.class.name.downcase}.attributes.#{@field}") end |
#object ⇒ Object
25 26 27 |
# File 'lib/app/components/input/file_component.rb', line 25 def object @item.send(@field) end |
#picture ⇒ Object
19 20 21 22 23 |
# File 'lib/app/components/input/file_component.rb', line 19 def picture return object unless @variant object.variant(@variant) end |