Sha256: a75109d16a504ca76af9f9310d31e387f57cf3ebf0aaf75c44608b2a8788a995

Contents?: true

Size: 482 Bytes

Versions: 24

Compression:

Stored size: 482 Bytes

Contents

# frozen_string_literal: true

module SirTrevorRails
  module Blocks
    ##
    # Mixin for blocks that display text
    module Displayable
      def items
        item_values.select { |x| x[:display] == 'true' }
      end

      def item_ids
        items.pluck(:id)
      end

      def ordered_items
        items.sort_by { |x| x[:weight].to_i }.pluck(:id)
      end

      private

      def item_values
        Array((item.values if item.present?))
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
blacklight-spotlight-4.3.6 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.3.5 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.3.4 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.3.3 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.3.2 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.3.1 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.3.0 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.2.0 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.1.2 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.1.1 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.1.0 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.0.3 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.0.2 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.0.1 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-4.0.0 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-3.6.0.beta10 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-3.6.0.beta9 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-3.6.0.beta8 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-3.6.0.beta7 app/models/sir_trevor_rails/blocks/displayable.rb
blacklight-spotlight-3.6.0.beta6 app/models/sir_trevor_rails/blocks/displayable.rb