Class: RPrec::Op
- Inherits:
-
Object
- Object
- RPrec::Op
- Defined in:
- lib/rprec/op.rb
Overview
Op
is an operator.
Instance Attribute Summary collapse
- #key ⇒ String readonly
- #parts ⇒ Array<String, Symbol> readonly
- #type ⇒ :prefix, ... readonly
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(type, key, parts, build) ⇒ Op
constructor
A new instance of Op.
- #inspect ⇒ String
Constructor Details
#initialize(type, key, parts, build) ⇒ Op
Returns a new instance of Op.
10 11 12 13 14 15 |
# File 'lib/rprec/op.rb', line 10 def initialize(type, key, parts, build) @type = type @key = key @parts = parts @build = build end |
Instance Attribute Details
#key ⇒ String (readonly)
22 23 24 |
# File 'lib/rprec/op.rb', line 22 def key @key end |
#parts ⇒ Array<String, Symbol> (readonly)
24 25 26 |
# File 'lib/rprec/op.rb', line 24 def parts @parts end |
#type ⇒ :prefix, ... (readonly)
20 21 22 |
# File 'lib/rprec/op.rb', line 20 def type @type end |
Instance Method Details
#build ⇒ Object
28 29 30 |
# File 'lib/rprec/op.rb', line 28 def build(*) @build.call(*) end |
#inspect ⇒ String
33 34 35 |
# File 'lib/rprec/op.rb', line 33 def inspect "#{type} #{([key] + parts).map(&:inspect).join(', ')}" end |