Class: String

Inherits:
Object
  • Object
show all
Includes:
Rtml::ReverseEngineering::Simulator::Casting, Rtml::Rules::DomValidation
Defined in:
lib/extensions/string.rb

Instance Method Summary collapse

Instance Method Details

#tml_should_not_resemble(structure) ⇒ Object

Verifies that the produced TML does NOT resemble the given structure. See Rtml::Rules::DomValidation#validate_tml_dom for more information.

Raises:

  • (Rtml::ProcessingError)


24
25
26
27
28
29
30
31
32
# File 'lib/extensions/string.rb', line 24

def tml_should_not_resemble(structure)
  inspected = structure.inspect
  begin
    validate_tml_dom(self, structure)
  rescue
    return true
  end
  raise Rtml::ProcessingError, "TML was expected not to resemble #{inspected}, but it did!", caller
end

#to_controllerObject



5
6
7
8
9
10
# File 'lib/extensions/string.rb', line 5

def to_controller
  camel = self.camelize
  "#{camel}Controller".constantize
rescue NameError
  camel.constantize
end

#valid_tml?Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/extensions/string.rb', line 12

def valid_tml?
  validate_tml(self)
  true
end

#validate_tml_structure(structure) ⇒ Object Also known as: tml_should_resemble



17
18
19
20
# File 'lib/extensions/string.rb', line 17

def validate_tml_structure(structure)
  validate_tml_dom(self, structure)
  true
end