Sha256: 2f23aa8e528ec6564cd329bfc52ed20ac9199988b481243c9903c0a40ce16a6d

Contents?: true

Size: 589 Bytes

Versions: 4

Compression:

Stored size: 589 Bytes

Contents

# frozen_string_literal: true

module Vedeu

  module Repositories

    # When included into a class, provides the mechanism to retrieve
    # the parent object for the class if available.
    #
    module Parent

      include Vedeu::Common

      # @return [NilClass|void]
      def parent
        present?(@parent) ? @parent : nil
      end

      # @return [NilClass|String|Symbol]
      def name
        if present?(@name)
          @name

        elsif parent && present?(parent.name)
          parent.name

        end
      end

    end # Parent

  end # Repositories

end # Vedeu

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.8.4 lib/vedeu/repositories/parent.rb
vedeu-0.8.3 lib/vedeu/repositories/parent.rb
vedeu-0.8.2 lib/vedeu/repositories/parent.rb
vedeu-0.8.1 lib/vedeu/repositories/parent.rb