Class: NRSER::Types::IsA
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Instance Method Summary collapse
- #default_name ⇒ Object
-
#initialize(klass, **options) ⇒ IsA
constructor
A new instance of IsA.
- #test(value) ⇒ Object
Methods inherited from Type
#check, #from_s, #has_from_s?, #has_to_data?, #name, #respond_to?, short_name, #to_data, #to_s
Constructor Details
#initialize(klass, **options) ⇒ IsA
Returns a new instance of IsA.
9 10 11 12 |
# File 'lib/nrser/types/is_a.rb', line 9 def initialize klass, ** super ** @klass = klass end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
7 8 9 |
# File 'lib/nrser/types/is_a.rb', line 7 def klass @klass end |
Instance Method Details
#default_name ⇒ Object
14 15 16 |
# File 'lib/nrser/types/is_a.rb', line 14 def default_name "#{ self.class.short_name }(#{ @klass })" end |
#test(value) ⇒ Object
18 19 20 |
# File 'lib/nrser/types/is_a.rb', line 18 def test value value.is_a? @klass end |