Class: SmartCore::Initializer::Type Private
- Inherits:
-
Object
- Object
- SmartCore::Initializer::Type
- Defined in:
- lib/smart_core/initializer/type.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary collapse
- #name ⇒ String readonly private
Instance Method Summary collapse
- #comparable?(value) ⇒ Boolean private
- #initialize(name, checker) ⇒ void constructor private
Constructor Details
#initialize(name, checker) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/smart_core/initializer/type.rb', line 18 def initialize(name, checker) unless name.is_a?(String) || name.is_a?(Symbol) raise(SmartCore::Initializer::ArgumentError, 'Type name should be a symbol or a string') end unless checker.is_a?(Proc) raise(SmartCore::Initializer::ArgumentError, 'Checker should be a proc') end @name = name.to_sym @checker = checker end |
Instance Attribute Details
#name ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
10 11 12 |
# File 'lib/smart_core/initializer/type.rb', line 10 def name @name end |
Instance Method Details
#comparable?(value) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 |
# File 'lib/smart_core/initializer/type.rb', line 38 def comparable?(value) checker.call(value) end |