Sha256: d254d57d33d0b2a1a87b628016ee4205b8808d042eb3d44a52f1f244c2e78a7e

Contents?: true

Size: 589 Bytes

Versions: 33

Compression:

Stored size: 589 Bytes

Contents

# frozen_string_literal: true

module Metatron
  module Templates
    module Concerns
      # Makes supporting annotated resources easier
      module Annotated
        def self.included(base)
          # base.extend ClassMethods
          base.class_eval do
            attr_accessor :annotations

            initializer :annotated_initialize
          end
        end

        def annotated_initialize
          @annotations = {}
        end

        def formatted_annotations
          annotations && !annotations.empty? ? { annotations: } : {}
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
metatron-0.8.2 lib/metatron/templates/concerns/annotated.rb
metatron-0.8.0 lib/metatron/templates/concerns/annotated.rb
metatron-0.7.0 lib/metatron/templates/concerns/annotated.rb
metatron-0.6.1 lib/metatron/templates/concerns/annotated.rb
metatron-0.6.0 lib/metatron/templates/concerns/annotated.rb
metatron-0.5.0 lib/metatron/templates/concerns/annotated.rb
metatron-0.4.2 lib/metatron/templates/concerns/annotated.rb
metatron-0.4.1 lib/metatron/templates/concerns/annotated.rb
metatron-0.4.0 lib/metatron/templates/concerns/annotated.rb
metatron-0.3.4 lib/metatron/templates/concerns/annotated.rb
metatron-0.3.3 lib/metatron/templates/concerns/annotated.rb
metatron-0.3.2 lib/metatron/templates/concerns/annotated.rb
metatron-0.3.1 lib/metatron/templates/concerns/annotated.rb
metatron-0.3.0 lib/metatron/templates/concerns/annotated.rb
metatron-0.2.8 lib/metatron/templates/concerns/annotated.rb
metatron-0.2.7 lib/metatron/templates/concerns/annotated.rb
metatron-0.2.6 lib/metatron/templates/concerns/annotated.rb
metatron-0.2.5 lib/metatron/templates/concerns/annotated.rb
metatron-0.2.4 lib/metatron/templates/concerns/annotated.rb
metatron-0.2.3 lib/metatron/templates/concerns/annotated.rb