Class: TableStructure::Utils::TypedProc

Inherits:
Proc
  • Object
show all
Defined in:
lib/table_structure/utils.rb

Instance Attribute Summary

Attributes inherited from Proc

#options

Instance Method Summary collapse

Constructor Details

#initialize(types:, **options, &block) ⇒ TypedProc

Returns a new instance of TypedProc.



15
16
17
18
# File 'lib/table_structure/utils.rb', line 15

def initialize(types:, **options, &block)
  @types = [types].flatten.compact
  super(**options, &block)
end

Instance Method Details

#typed?(type) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/table_structure/utils.rb', line 20

def typed?(type)
  @types.include?(type)
end