Class: RBS::Types::Block
- Inherits:
-
Object
- Object
- RBS::Types::Block
- Defined in:
- lib/rbs/types.rb
Instance Attribute Summary collapse
-
#required ⇒ Object
readonly
Returns the value of attribute required.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(type:, required:) ⇒ Block
constructor
A new instance of Block.
- #map_type(&block) ⇒ Object
- #sub(s) ⇒ Object
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(type:, required:) ⇒ Block
Returns a new instance of Block.
954 955 956 957 |
# File 'lib/rbs/types.rb', line 954 def initialize(type:, required:) @type = type @required = required end |
Instance Attribute Details
#required ⇒ Object (readonly)
Returns the value of attribute required.
952 953 954 |
# File 'lib/rbs/types.rb', line 952 def required @required end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
951 952 953 |
# File 'lib/rbs/types.rb', line 951 def type @type end |
Instance Method Details
#==(other) ⇒ Object
959 960 961 962 963 |
# File 'lib/rbs/types.rb', line 959 def ==(other) other.is_a?(Block) && other.type == type && other.required == required end |
#map_type(&block) ⇒ Object
979 980 981 982 983 984 |
# File 'lib/rbs/types.rb', line 979 def map_type(&block) Block.new( required: required, type: type.map_type(&block) ) end |
#sub(s) ⇒ Object
972 973 974 975 976 977 |
# File 'lib/rbs/types.rb', line 972 def sub(s) self.class.new( type: type.sub(s), required: required ) end |
#to_json(*a) ⇒ Object
965 966 967 968 969 970 |
# File 'lib/rbs/types.rb', line 965 def to_json(*a) { type: type, required: required }.to_json(*a) end |