Class: Rtype::RtypeComponent

Inherits:
Object
  • Object
show all
Defined in:
lib/rtype/rtype_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRtypeComponent

Returns a new instance of RtypeComponent.



6
7
8
9
10
11
12
# File 'lib/rtype/rtype_component.rb', line 6

def initialize
	@annotation_mode = false
	@annotation_type_sig = nil
	@ignoring = false
	@undef_methods = {}
	@old_methods = {}
end

Instance Attribute Details

#annotation_modeObject

Returns the value of attribute annotation_mode.



3
4
5
# File 'lib/rtype/rtype_component.rb', line 3

def annotation_mode
  @annotation_mode
end

#annotation_type_sigObject

Returns the value of attribute annotation_type_sig.



3
4
5
# File 'lib/rtype/rtype_component.rb', line 3

def annotation_type_sig
  @annotation_type_sig
end

#ignoringObject

Returns the value of attribute ignoring.



3
4
5
# File 'lib/rtype/rtype_component.rb', line 3

def ignoring
  @ignoring
end

#old_methodsObject (readonly)

Returns the value of attribute old_methods.



4
5
6
# File 'lib/rtype/rtype_component.rb', line 4

def old_methods
  @old_methods
end

#undef_methodsObject (readonly)

Returns the value of attribute undef_methods.



4
5
6
# File 'lib/rtype/rtype_component.rb', line 4

def undef_methods
  @undef_methods
end

Instance Method Details

#add_undef(name, expected_args, return_sig, singleton) ⇒ Object

Parameters:

  • name (Symbol)
  • expected_args (Array)
  • return_sig
  • singleton (Boolean)


31
32
33
34
35
# File 'lib/rtype/rtype_component.rb', line 31

def add_undef(name, expected_args, return_sig, singleton)
	obj = { expected: expected_args, result: return_sig }
	@undef_methods[singleton] ||= {}
	@undef_methods[singleton][name] = obj
end

#get_old(name, singleton) ⇒ Object



19
20
21
# File 'lib/rtype/rtype_component.rb', line 19

def get_old(name, singleton)
	@old_methods[singleton][name]
end

#get_undef(name, singleton) ⇒ Object



45
46
47
# File 'lib/rtype/rtype_component.rb', line 45

def get_undef(name, singleton)
	@undef_methods[singleton][name]
end

#has_old?(name, singleton) ⇒ Boolean

Returns:



23
24
25
# File 'lib/rtype/rtype_component.rb', line 23

def has_old?(name, singleton)
	@old_methods.key?(singleton) && @old_methods[singleton].key?(name)
end

#has_undef?(name, singleton) ⇒ Boolean

Returns:



37
38
39
# File 'lib/rtype/rtype_component.rb', line 37

def has_undef?(name, singleton)
	@undef_methods.key?(singleton) && @undef_methods[singleton].key?(name)
end

#remove_undef(name, singleton) ⇒ Object



41
42
43
# File 'lib/rtype/rtype_component.rb', line 41

def remove_undef(name, singleton)
	@undef_methods[singleton].delete(name)
end

#set_old(name, singleton, method) ⇒ Object



14
15
16
17
# File 'lib/rtype/rtype_component.rb', line 14

def set_old(name, singleton, method)
	@old_methods[singleton] ||= {}
	@old_methods[singleton][name] = method
end