Module: Turnt
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
2
3
4
5
|
# File 'lib/turnt.rb', line 2
def method_missing(method, *args)
super(method, *args) unless has?(method)
@method = method; @value = send(instance_method); validate_data_types!
end
|
Instance Method Details
#collection_validation! ⇒ Object
23
24
25
|
# File 'lib/turnt.rb', line 23
def collection_validation!
empty? if @value.is_a?(Array) || @value.is_a?(Hash)
end
|
#nil_validation! ⇒ Object
7
8
9
|
# File 'lib/turnt.rb', line 7
def nil_validation!
nil? if @value.nil?
end
|
#numeric_validation! ⇒ Object
11
12
13
|
# File 'lib/turnt.rb', line 11
def numeric_validation!
nil? if @value.is_a?(Numeric)
end
|
#string_validation! ⇒ Object
15
16
17
|
# File 'lib/turnt.rb', line 15
def string_validation!
empty? if @value.is_a?(String)
end
|
#symbol_validation! ⇒ Object
19
20
21
|
# File 'lib/turnt.rb', line 19
def symbol_validation!
nil? if @value.is_a?(Symbol)
end
|