Class: Sym::Handle
- Inherits:
-
Object
- Object
- Sym::Handle
- Defined in:
- lib/sym.rb
Instance Attribute Summary collapse
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(tag) ⇒ Handle
constructor
A new instance of Handle.
- #method_missing(name, *args) ⇒ Object
- #respond_to_missing? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(tag) ⇒ Handle
Returns a new instance of Handle.
84 |
# File 'lib/sym.rb', line 84 def initialize(tag); @tag = tag; end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Attribute Details
#tag ⇒ Object (readonly)
Returns the value of attribute tag.
83 84 85 |
# File 'lib/sym.rb', line 83 def tag @tag end |
Instance Method Details
#[](key) ⇒ Object
91 92 93 94 |
# File 'lib/sym.rb', line 91 def [](key) Sym.request({ "op" => "index", "lang" => @tag["runtime"], "handle" => @tag["id"], "args" => [key] }) end |
#respond_to_missing? ⇒ Boolean
90 |
# File 'lib/sym.rb', line 90 def respond_to_missing?(*); true; end |
#to_s ⇒ Object
95 |
# File 'lib/sym.rb', line 95 def to_s; "#<Sym::Handle #{@tag["runtime"]}##{@tag["id"]} #{@tag["type"]}>"; end |