Sha256: 481f50201f85ac1d16e6e549dd9514396403095d178da9e4e7100d2462cff8cc

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

# -*- encoding: utf-8 -*-

module WatchTower
  module Editor
    module BasePs
      def self.included(base)
        base.send :include, InstanceMethods
      end

      module InstanceMethods
        def self.included(base)
          base.class_eval <<-END, __FILE__, __LINE__ + 1
            # Returns the name of the editor
            #
            # Child class should implement this method
            def name
              raise NotImplementedError, "Please define this function in your class."
            end

            # Returns the version of the editor
            #
            # Child class should implement this method
            def version
              raise NotImplementedError, "Please define this function in your class."
            end

            # The editor's name for the log
            # Child classes can overwrite this method
            #
            # @return [String]
            def to_s
              "\#{self.class.to_s.split('::').last} Editor"
            end
          END
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watch_tower-0.0.1.beta8 lib/watch_tower/editor/base_ps.rb
watch_tower-0.0.1.beta7 lib/watch_tower/editor/base_ps.rb
watch_tower-0.0.1.beta6 lib/watch_tower/editor/base_ps.rb