Class: T::Types::TypedRange

Inherits:
TypedEnumerable show all
Defined in:
lib/types/types/typed_range.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from TypedEnumerable

#describe_obj, #initialize

Methods inherited from Base

#==, #describe_obj, #error_message_for_obj, #hash, method_added, #subtype_of?, #to_s, #validate!

Constructor Details

This class inherits a constructor from T::Types::TypedEnumerable

Instance Attribute Details

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/types/types/typed_range.rb', line 6

def type
  @type
end

Instance Method Details

#nameObject



13
14
15
# File 'lib/types/types/typed_range.rb', line 13

def name
  "T::Range[#{@type.name}]"
end

#new(*args) ⇒ Object

rubocop:disable PrisonGuard/BanBuiltinMethodOverride



22
23
24
# File 'lib/types/types/typed_range.rb', line 22

def new(*args) # rubocop:disable PrisonGuard/BanBuiltinMethodOverride
  T.unsafe(Range).new(*args)
end

#underlying_classObject



8
9
10
# File 'lib/types/types/typed_range.rb', line 8

def underlying_class
  Hash
end

#valid?(obj) ⇒ Boolean

Returns:



18
19
20
# File 'lib/types/types/typed_range.rb', line 18

def valid?(obj)
  obj.is_a?(Range) && super
end