Class: Charming::Presentation::Components::Form::Note

Inherits:
Field show all
Defined in:
lib/charming/presentation/components/form/note.rb

Instance Attribute Summary

Attributes inherited from Field

#help, #label, #name, #state

Instance Method Summary collapse

Methods inherited from Field

#handle_key, #value

Methods inherited from View

#focused?, #layout_assigns

Constructor Details

#initialize(text, name: :note, theme: nil) ⇒ Note

Returns a new instance of Note.



8
9
10
11
# File 'lib/charming/presentation/components/form/note.rb', line 8

def initialize(text, name: :note, theme: nil)
  super(name, theme: theme)
  @text = text
end

Instance Method Details

#bind(state) ⇒ Object



13
14
15
# File 'lib/charming/presentation/components/form/note.rb', line 13

def bind(state)
  @state = state
end

#focusable?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/charming/presentation/components/form/note.rb', line 17

def focusable?
  false
end

#render(active: false) ⇒ Object



25
26
27
# File 'lib/charming/presentation/components/form/note.rb', line 25

def render(active: false)
  @text.to_s
end

#validateObject



21
22
23
# File 'lib/charming/presentation/components/form/note.rb', line 21

def validate
  []
end