Module: Eapi::Methods::Types
- Defined in:
- lib/eapi/methods/types.rb
Defined Under Namespace
Modules: Checker, ClassMethods, InstanceMethods, IsAnOtherTypeMethods
Class Method Summary
collapse
Class Method Details
.check_asking_type(method, obj) ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'lib/eapi/methods/types.rb', line 16
def self.check_asking_type(method, obj)
type = Types.type_question_method method
if type
obj.is?(type)
else
nil
end
end
|
.to_type_sym(x) ⇒ Object
25
26
27
|
# File 'lib/eapi/methods/types.rb', line 25
def self.to_type_sym(x)
x.to_s.underscore.to_sym
end
|
.type_question_method(method) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/eapi/methods/types.rb', line 4
def self.type_question_method(method)
ms = method.to_s
return false unless ms.end_with?('?')
if ms.start_with?('is_a_')
ms.sub('is_a_', '').sub('?', '')
elsif ms.start_with?('is_an_')
ms.sub('is_an_', '').sub('?', '')
else
nil
end
end
|