Module: Eapi::Methods::Types::ClassMethods

Included in:
Common::ClassMethods
Defined in:
lib/eapi/methods/types.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



60
61
62
# File 'lib/eapi/methods/types.rb', line 60

def self.included(klass)
  klass.send :include, IsAnOtherTypeMethods
end

Instance Method Details

#is(*types) ⇒ Object



74
75
76
77
78
79
# File 'lib/eapi/methods/types.rb', line 74

def is(*types)
  ts = types.map { |t| Types.to_type_sym t }

  @i_am_a ||= []
  @i_am_a.concat ts
end

#is?(type) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
67
68
69
70
71
72
# File 'lib/eapi/methods/types.rb', line 64

def is?(type)
  return true if Checker._is_type_module?(self, type)

  type_sym = Types.to_type_sym type
  return true if Checker._is_type_module_sym?(self, type_sym)

  return false unless @i_am_a.present?
  !!@i_am_a.include?(type_sym) # force it to be a bool
end