Sha256: 6887200165aa31a715358702fc1ddb4c9044c9f95b2bcf3f41e349f8f9841878

Contents?: true

Size: 397 Bytes

Versions: 4

Compression:

Stored size: 397 Bytes

Contents

class Section < Array
  attr_reader :name
  
  def initialize(name)
    @name = name
    super()
  end
  
  def display?
    any? {|field| display_field?(field)}
  end
  
  def displayed_fields
    select {|field| display_field?(field)}
  end
  
  private
    def display_field?(field)
      field.display? && field.default_input_type.present? && field.default_input_type != :embedded
    end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yodel-0.0.4 lib/yodel/models/core/record/section.rb
yodel-0.0.3 lib/yodel/models/core/record/section.rb
yodel-0.0.2 lib/yodel/models/core/record/section.rb
yodel-0.0.1 lib/yodel/models/core/record/section.rb