class XLFormSectionDescriptor
Attributes
section_data[RW]
Public Class Methods
parse_section_options(options)
click to toggle source
# File lib/ProMotion/XLForm/xl_form_patch.rb, line 132 def self.parse_section_options(options) return section_options(:none) if options.nil? opts = section_options(:none) unless options.is_a?(Array) options = [options] end options.each do |opt| opts |= section_options(opt) end opts end
section(section_data)
click to toggle source
# File lib/ProMotion/XLForm/xl_form_patch.rb, line 101 def self.section(section_data) title = section_data[:title] options = section_data.fetch(:options, :none) options = parse_section_options(options) insert_mode = section_insert_mode(section_data[:insert_mode]) section = XLFormSectionDescriptor.formSectionWithTitle(title, sectionOptions: options, sectionInsertMode: insert_mode) section.section_data = section_data section end
section_insert_mode(symbol)
click to toggle source
# File lib/ProMotion/XLForm/xl_form_patch.rb, line 146 def self.section_insert_mode(symbol) { last_row: XLFormSectionInsertModeLastRow, button: XLFormSectionInsertModeButton }[symbol] || symbol || XLFormSectionInsertModeLastRow end
section_options(symbol)
click to toggle source
# File lib/ProMotion/XLForm/xl_form_patch.rb, line 153 def self.section_options(symbol) { none: XLFormSectionOptionNone, insert: XLFormSectionOptionCanInsert, delete: XLFormSectionOptionCanDelete, reorder: XLFormSectionOptionCanReorder }[symbol] || symbol || XLFormSectionOptionNone end
Public Instance Methods
options=(value)
click to toggle source
# File lib/ProMotion/XLForm/xl_form_patch.rb, line 114 def options=(value) @section_options = self.class.parse_section_options(value) end
originalSectionOptions()
Since `sectionOptions` is a property on the Objective-C class and not a Ruby method we can't use `super` to fallback when overriding the method. To achieve the same thing we create an alias and use that instead.
Alias for: sectionOptions
sectionOptions()
click to toggle source
This property/method is used in the Objective-C initializer and is called before we ever have a chance to set @section_options so we need to be able to fallback to the original.
# File lib/ProMotion/XLForm/xl_form_patch.rb, line 126 def sectionOptions @section_options || originalSectionOptions end
Also aliased as: originalSectionOptions, options