Module: Fiveruns::Dash::Typable

Included in:
Metric, SCM
Defined in:
lib/fiveruns/dash/typable.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fiveruns/dash/typable.rb', line 5

def self.included(base)
  name = Fiveruns::Dash::Util.shortname(base.name)
  base.class_eval %{
    def self.#{name}_type
      @#{name}_type ||= begin
        short = Fiveruns::Dash::Util.shortname(name)
        short.sub(/_#{name}$/, '').to_sym
      end
    end
  }
  base.extend ClassMethods
end