Class: StringLength

Inherits:
InstanceCall show all
Defined in:
lib/core/instance_call/StringLength.rb

Instance Method Summary collapse

Methods inherited from InstanceCall

#closure, #describe, #destructive?, #response, #to_declaration, #valid_syntax?

Methods inherited from Array

#cauldron_method_calls, #contains?, #select_all, #to_declaration, #to_intrinsic, #to_literal, #to_var

Constructor Details

#initializeStringLength

Returns a new instance of StringLength.



3
4
5
6
7
8
9
10
# File 'lib/core/instance_call/StringLength.rb', line 3

def initialize
  super
  
  @use_requirements = [
    Requirement.new(InstanceCallContainer.new(This.new,ClassCall.new), Equal.new , StringClass.new)
  ]    
  
end

Instance Method Details

#copyObject



16
17
18
# File 'lib/core/instance_call/StringLength.rb', line 16

def copy
  return StringLength.new
end

#requirementsObject



20
21
22
# File 'lib/core/instance_call/StringLength.rb', line 20

def requirements
  @use_requirements.each {|req| yield req}
end

#to_literal_stringObject



28
29
30
# File 'lib/core/instance_call/StringLength.rb', line 28

def to_literal_string
  return write
end

#use(val) ⇒ Object



24
25
26
# File 'lib/core/instance_call/StringLength.rb', line 24

def use(val)
  return val.length
end

#writeObject



12
13
14
# File 'lib/core/instance_call/StringLength.rb', line 12

def write
  return '.length'
end