Class: Dentaku::AST::StringFunctions::Right
- Defined in:
- lib/dentaku/ast/functions/string_functions.rb
Instance Method Summary collapse
-
#initialize(string, length) ⇒ Right
constructor
A new instance of Right.
- #value(context = {}) ⇒ Object
Methods inherited from Function
#dependencies, get, register, register_class
Methods inherited from Node
arity, #dependencies, precedence
Constructor Details
#initialize(string, length) ⇒ Right
Returns a new instance of Right.
18 19 20 21 |
# File 'lib/dentaku/ast/functions/string_functions.rb', line 18 def initialize(string, length) @string = string @length = length end |
Instance Method Details
#value(context = {}) ⇒ Object
23 24 25 26 27 |
# File 'lib/dentaku/ast/functions/string_functions.rb', line 23 def value(context={}) string = @string.value(context) length = @length.value(context) string[length * -1, length] || string end |