Module: Inform::Parser
- Includes:
- Articles
- Defined in:
- lib/runtime/articles.rb
Overview
Re-open the Inform::Parser module
Constant Summary collapse
- VowelsOrHiPattern =
%r{^([aeiou]|hi).+}.freeze
Constants included from Articles
Articles::LowercaseASpaceString, Articles::LowercaseSomeSpaceString, Articles::LowercaseTheSpaceString
Instance Method Summary collapse
-
#PrefaceByArticle(o, _acode, pluralise = false, capitalise = false) ⇒ Object
TODO: Figure out why this isn’t being called by #a(obj) above.
Methods included from Articles
#A, #Cthatorthose, #Ctheyreorthats, #The, #a, #cthatorthose, #ctheyreorthats, #defart, #indefart, #isorare, #itorthem, #thatorthose, #the
Instance Method Details
#PrefaceByArticle(o, _acode, pluralise = false, capitalise = false) ⇒ Object
TODO: Figure out why this isn’t being called by #a(obj) above. rubocop: disable Metrics/AbcSize rubocop: disable Metrics/CyclomaticComplexity rubocop: disable Metrics/MethodLength rubocop: disable Metrics/PerceivedComplexity
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/runtime/articles.rb', line 112 def PrefaceByArticle(o, _acode, pluralise = false, capitalise = false) log.info "wtf1 #{self.class}##{__method__}" # TODO: Remove if (obj_articles = o.&:articles) && obj_articles.respond_to?(:[]) return obj_articles[acode] unless obj_articles[acode].nil? return if pluralise end return if pluralise if VowelsOrHiPattern.match?(o.to_s) return "an #{o}".sentence_case if capitalise "an #{o}" else return "a #{o}".sentence_case if capitalise "a #{o}" end end |