Class: Keisan::Tokens::Group
- Inherits:
-
Keisan::Token
- Object
- Keisan::Token
- Keisan::Tokens::Group
- Defined in:
- lib/keisan/tokens/group.rb
Instance Attribute Summary collapse
-
#sub_tokens ⇒ Object
readonly
Returns the value of attribute sub_tokens.
Attributes inherited from Keisan::Token
Instance Method Summary collapse
-
#group_type ⇒ Object
Either :round, :square.
-
#initialize(string) ⇒ Group
constructor
A new instance of Group.
Methods inherited from Keisan::Token
Constructor Details
Instance Attribute Details
#sub_tokens ⇒ Object (readonly)
Returns the value of attribute sub_tokens.
4 5 6 |
# File 'lib/keisan/tokens/group.rb', line 4 def sub_tokens @sub_tokens end |
Instance Method Details
#group_type ⇒ Object
Either :round, :square
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/keisan/tokens/group.rb', line 12 def group_type case string[0] when "(" :round when "[" :square when "{" :curly end end |