Class: TypedRb::Model::TmRegexp
- Defined in:
- lib/typed/model/tm_regexp.rb
Overview
Regular expresssion
Instance Attribute Summary collapse
-
#exp ⇒ Object
readonly
Returns the value of attribute exp.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Attributes inherited from Expr
Instance Method Summary collapse
- #check_type(context) ⇒ Object
-
#initialize(exp, options, node) ⇒ TmRegexp
constructor
A new instance of TmRegexp.
Constructor Details
#initialize(exp, options, node) ⇒ TmRegexp
Returns a new instance of TmRegexp.
9 10 11 12 13 |
# File 'lib/typed/model/tm_regexp.rb', line 9 def initialize(exp, , node) super(node) @exp = exp @ptions = end |
Instance Attribute Details
#exp ⇒ Object (readonly)
Returns the value of attribute exp.
8 9 10 |
# File 'lib/typed/model/tm_regexp.rb', line 8 def exp @exp end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/typed/model/tm_regexp.rb', line 8 def @options end |
Instance Method Details
#check_type(context) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/typed/model/tm_regexp.rb', line 15 def check_type(context) .check_type(context) if exp_type = exp.check_type(context) if exp_type.compatible?(Types::TyString.new(node), :lt) Types::TyRegexp.new(node) else = "Error type checking Regexp: Expected String type for expression, found #{exp_type}" fail Types::TypeCheckError.new(, node) end end |