Class: Anoubis::Output::FrameButtonItem
- Inherits:
-
Object
- Object
- Anoubis::Output::FrameButtonItem
- Defined in:
- app/controllers/anoubis/output/frame.rb
Overview
Subclass of frame button element.
Instance Attribute Summary collapse
-
#decorate ⇒ string
Button decoration (‘none’, ‘space’).
-
#hint ⇒ string
The button hint.
-
#key ⇒ string
The button identificator.
-
#mode ⇒ string
The button action object (‘single’, ‘multiple’).
-
#title ⇒ string
The button title.
-
#type ⇒ string
The type of the button (‘primary’, ‘danger’, ‘default’).
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ FrameButtonItem
constructor
Initializes button element data.
-
#to_h ⇒ Hash
Generates hash representation of output class.
Constructor Details
#initialize(options = {}) ⇒ FrameButtonItem
Initializes button element data. Generates default values.
202 203 204 205 206 207 208 209 |
# File 'app/controllers/anoubis/output/frame.rb', line 202 def initialize( = {}) self.key = .key?(:key) ? [:key].to_s : '' self.type = .key?(:type) ? [:type].to_s : 'default' self.mode = .key?(:mode) ? [:mode].to_s : 'single' self.title = .key?(:title) ? [:title].to_s : '' self.hint = .key?(:hint) ? [:hint].to_s : '' self.decoration = .key?(:decoration) ? [:decoration] : 'none' end |
Instance Attribute Details
#decorate ⇒ string
Returns button decoration (‘none’, ‘space’).
198 |
# File 'app/controllers/anoubis/output/frame.rb', line 198 class_attribute :decoration, default: 'none' |
#hint ⇒ string
Returns the button hint.
186 |
# File 'app/controllers/anoubis/output/frame.rb', line 186 class_attribute :hint |
#key ⇒ string
Returns the button identificator.
178 |
# File 'app/controllers/anoubis/output/frame.rb', line 178 class_attribute :key |
#mode ⇒ string
Returns the button action object (‘single’, ‘multiple’).
190 |
# File 'app/controllers/anoubis/output/frame.rb', line 190 class_attribute :mode, default: 'single' |
#title ⇒ string
Returns the button title.
182 |
# File 'app/controllers/anoubis/output/frame.rb', line 182 class_attribute :title |
#type ⇒ string
Returns the type of the button (‘primary’, ‘danger’, ‘default’).
194 |
# File 'app/controllers/anoubis/output/frame.rb', line 194 class_attribute :type, default: 'default' |
Instance Method Details
#to_h ⇒ Hash
Generates hash representation of output class
214 215 216 217 218 219 220 221 222 223 224 |
# File 'app/controllers/anoubis/output/frame.rb', line 214 def to_h result = { key: self.key, mode: self.mode, type: self.type, decoration: self.decoration } result[:title] = self.title if self.title != '' result[:hint] = self.hint if self.hint != '' result end |