Sha256: b3cb9c2b1f70ae06215aafef74711b2ece5ed0fab481f8c49cfddaa4d9b22944

Contents?: true

Size: 558 Bytes

Versions: 1

Compression:

Stored size: 558 Bytes

Contents

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

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.8.0 lib/vedeu/repositories/parent.rb