Class: Anoubis::Output::FrameButtonItem

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/anoubis/output/frame.rb

Overview

Subclass of frame button element.

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options = {})
  self.key = options.key?(:key) ? options[:key].to_s : ''
  self.type = options.key?(:type) ? options[:type].to_s : 'default'
  self.mode = options.key?(:mode) ? options[:mode].to_s : 'single'
  self.title = options.key?(:title) ? options[:title].to_s : ''
  self.hint = options.key?(:hint) ? options[:hint].to_s : ''
  self.decoration = options.key?(:decoration) ? options[:decoration] : 'none'
end

Instance Attribute Details

#decoratestring

Returns button decoration (‘none’, ‘space’).

Returns:

  • (string)

    button decoration (‘none’, ‘space’)



198
# File 'app/controllers/anoubis/output/frame.rb', line 198

class_attribute :decoration, default: 'none'

#hintstring

Returns the button hint.

Returns:

  • (string)

    the button hint.



186
# File 'app/controllers/anoubis/output/frame.rb', line 186

class_attribute :hint

#keystring

Returns the button identificator.

Returns:

  • (string)

    the button identificator.



178
# File 'app/controllers/anoubis/output/frame.rb', line 178

class_attribute :key

#modestring

Returns the button action object (‘single’, ‘multiple’).

Returns:

  • (string)

    the button action object (‘single’, ‘multiple’)



190
# File 'app/controllers/anoubis/output/frame.rb', line 190

class_attribute :mode, default: 'single'

#titlestring

Returns the button title.

Returns:

  • (string)

    the button title.



182
# File 'app/controllers/anoubis/output/frame.rb', line 182

class_attribute :title

#typestring

Returns the type of the button (‘primary’, ‘danger’, ‘default’).

Returns:

  • (string)

    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_hHash

Generates hash representation of output class

Returns:

  • (Hash)

    hash representation of all data



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