Class: Fort::Type::Numeric

Inherits:
Base
  • Object
show all
Defined in:
lib/fort/type.rb

Direct Known Subclasses

Complex, Integer, Real

Constant Summary

Constants included from Providable

Providable::ID_GENERATOR

Instance Attribute Summary collapse

Attributes inherited from Base

#dim, #id, #type

Instance Method Summary collapse

Methods inherited from Base

#dimension, #parenthesis

Methods included from Providable

#multi_provide, #provide

Constructor Details

#initialize(id, params = {}) ⇒ Numeric

Returns a new instance of Numeric.



82
83
84
85
# File 'lib/fort/type.rb', line 82

def initialize(id, params = {})
  super
  @kind = params.fetch(:kind)
end

Instance Attribute Details

#kindObject (readonly)

Returns the value of attribute kind.



86
87
88
# File 'lib/fort/type.rb', line 86

def kind
  @kind
end

Instance Method Details

#declareObject



92
93
94
# File 'lib/fort/type.rb', line 92

def declare
  "#{@type}(kind=#{@kind})#{dimension()}"
end

#to_sObject



88
89
90
# File 'lib/fort/type.rb', line 88

def to_s
  super + "Kind#{@kind}"
end