Sha256: 01df9b5a64934d7b045ec3d8fc8769c0ddc0273a0fe9dc73ab58b75cadf363a0

Contents?: true

Size: 756 Bytes

Versions: 39

Compression:

Stored size: 756 Bytes

Contents

module Promethee::StructureUpgrader::Components
  class Base
    def initialize(data)
      @data = data
      # puts "<#{self.class}> Initialized."

      upgrade
    end

    def upgraded_data
      @upgraded_data
    end

    def upgrade
      @upgraded_data = @data.deep_dup
      @upgraded_data['attributes'] ||= {}
      return if @upgraded_data['attributes'].empty?

      @upgraded_data['attributes'] = upgraded_attributes.deep_stringify_keys
    end

    def upgraded_attributes
      raise NotImplementedError
    end

    protected

    def string_attribute(*path)
      text = attribute(*path)
      Loofah.fragment(text).text(encode_special_chars: false)
    end

    def attribute(*path)
      @data.dig('attributes', *path)
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
promethee-5.1.1 app/services/promethee/structure_upgrader/components/base.rb
promethee-5.1.0 app/services/promethee/structure_upgrader/components/base.rb
promethee-5.0.2 app/services/promethee/structure_upgrader/components/base.rb
promethee-5.0.1 app/services/promethee/structure_upgrader/components/base.rb
promethee-5.0.0 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.28 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.27 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.26 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.25 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.24 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.23 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.22 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.21 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.20 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.19 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.18 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.17 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.16 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.15 app/services/promethee/structure_upgrader/components/base.rb
promethee-4.1.14 app/services/promethee/structure_upgrader/components/base.rb