Sha256: fa125275a3977177ff1cbb79c7180049738e736a432d2ac82ad9818da497e975

Contents?: true

Size: 843 Bytes

Versions: 1

Compression:

Stored size: 843 Bytes

Contents

module Vedeu

  # Allows the storing of interface/view borders independent of the interface
  # instance.
  #
  class Borders < Repository

    # @return [Vedeu::Borders]
    def self.borders
      @borders ||= reset! # Vedeu::Borders.new(Vedeu::Border)
    end

    # @return [Vedeu::Borders]
    def self.repository
      Vedeu.borders
    end

    # @return [Vedeu::Borders]
    def self.reset!
      @borders = Vedeu::Borders.register_repository(Vedeu::Border)
    end

    # @param name [String] The name of the stored border.
    # @return [Vedeu::Border|Vedeu::NullBorder|NilClass]
    def by_name(name)
      if registered?(name)
        find(name)

      elsif Vedeu.interfaces.registered?(name)
        interface = Vedeu.interfaces.find(name)
        Vedeu::NullBorder.new(interface)

      end
    end

  end # Borders

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.4.14 lib/vedeu/repositories/repositories/borders.rb