Class: Steep::TypeName::Class
Constant Summary collapse
- NOTHING =
Object.new
Instance Attribute Summary collapse
-
#constructor ⇒ Object
readonly
Returns the value of attribute constructor.
Attributes inherited from Base
Instance Method Summary collapse
- #==(other) ⇒ Object
- #hash ⇒ Object
-
#initialize(name:, constructor:) ⇒ Class
constructor
A new instance of Class.
- #map_module_name ⇒ Object
- #to_s ⇒ Object
- #updated(constructor: NOTHING) ⇒ Object
Constructor Details
#initialize(name:, constructor:) ⇒ Class
Returns a new instance of Class.
51 52 53 54 |
# File 'lib/steep/type_name.rb', line 51 def initialize(name:, constructor:) super(name: name) @constructor = constructor end |
Instance Attribute Details
#constructor ⇒ Object (readonly)
Returns the value of attribute constructor.
36 37 38 |
# File 'lib/steep/type_name.rb', line 36 def constructor @constructor end |
Instance Method Details
#==(other) ⇒ Object
56 57 58 |
# File 'lib/steep/type_name.rb', line 56 def ==(other) other.is_a?(self.class) && other.name == name && other.constructor == constructor end |
#hash ⇒ Object
60 61 62 |
# File 'lib/steep/type_name.rb', line 60 def hash self.class.hash ^ name.hash ^ constructor.hash end |
#map_module_name ⇒ Object
74 75 76 |
# File 'lib/steep/type_name.rb', line 74 def map_module_name self.class.new(name: yield(name), constructor: constructor) end |
#to_s ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/steep/type_name.rb', line 38 def to_s k = case constructor when nil "" when true " constructor" when false " noconstructor" end "#{name}.class#{k}" end |