Module: Confabulator::ConfabulatorLanguage::Substitution3

Defined in:
lib/confabulator/language.rb

Instance Method Summary collapse

Instance Method Details

#confabulate(kb = nil) ⇒ Object



513
514
515
516
517
518
519
520
521
522
523
524
525
526
# File 'lib/confabulator/language.rb', line 513

def confabulate(kb = nil)
	if kb
		result = kb.find(name.text_value).confabulate
		if options.text_value =~ /p/
			result = result.en.plural
		end
		if options.text_value =~ /c/
			result[0] = result[0].upcase if result[0]
		end
		result
	else
		""
	end
end

#tree(kb = nil) ⇒ Object



528
529
530
531
532
533
534
535
536
537
538
539
540
541
# File 'lib/confabulator/language.rb', line 528

def tree(kb = nil)
		if kb
			results = kb.find(name.text_value).tree
			if options.text_value =~ /p/
			  results = { :pluralize => results }
			end
			if options.text_value =~ /c/
			  results = { :capitalize => results }
			end
			results
		else
			""
		end
end