Class: Titlify::Data
- Inherits:
-
Object
- Object
- Titlify::Data
- Defined in:
- lib/titlify/data/word_lists.rb,
lib/titlify/data/smart_format_rules.rb
Class Method Summary collapse
- .articles ⇒ Object
- .coordinating_conjunctions ⇒ Object
- .copulae ⇒ Object
- .prefixes ⇒ Object
- .prepositions ⇒ Object
- .smart_format_rules ⇒ Object
- .special_cases ⇒ Object
- .word_list ⇒ Object
Class Method Details
.articles ⇒ Object
5 6 7 |
# File 'lib/titlify/data/word_lists.rb', line 5 def self.articles %w(a an the some) end |
.coordinating_conjunctions ⇒ Object
9 10 11 |
# File 'lib/titlify/data/word_lists.rb', line 9 def self.coordinating_conjunctions %w(and but or nor for yet so) end |
.copulae ⇒ Object
23 24 25 |
# File 'lib/titlify/data/word_lists.rb', line 23 def self.copulae %w(be am is are being was were been to\ be will\ be has\ been have\ been is\ being are\ being) end |
.prefixes ⇒ Object
27 28 29 |
# File 'lib/titlify/data/word_lists.rb', line 27 def self.prefixes %w(a anti arch be co counter de dis en em ex fore in il im ir inter mal mid mini mis out over post pre pro re self step trans twi un under up with) end |
.prepositions ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/titlify/data/word_lists.rb', line 13 def self.prepositions %w(a abaft aboard about above absent across afore after against along alongside amid amidst among amongst an apropos around as aside astride athwart atop barring before behind below beneath beside besides between betwixt beyond but by circa concerning despite down during except excluding failing following for from given in including inside into lest like mid midst minus modulo near next notwithstanding of off on onto opposite out outside over pace past per plus pro qua regarding round sans save since than through throughout till to toward towards under underneath unlike until up upon versus via vice with within without worth) # Not included because same spelling is more commonly a different part of speech # times # Included in special cases # at end |
.smart_format_rules ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/titlify/data/smart_format_rules.rb', line 5 def self.smart_format_rules [ ["'tain't", "’tain’t"], ["'twere", "’twere"], ["'twas", "’twas"], ["'tis", "’tis"], ["'twill", "’twill"], ["'til", "’til"], ["'bout", "’bout"], ["'nuff", "’nuff"], ["'round", "’round"], ["'cause", "’cause"], ["'cos", "’cos"], ["i'm", "i’m"], ['--"', "—”"], ["--'", "—’"], ["--", "—"], ["...", "…"], ["(tm)", "™"], ["(TM)", "™"], ["(c)", "©"], ["(r)", "®"], ["(R)", "®"], [/s\'([^a-zA-Z0-9])/, "s’\\1"], [/"([:;])/, "”\\1"], [/\'s$/, "’s"], [/\'(\d\d(?:’|\')?s)/, "’\\1"], [/(\s|\A|"|\(|\[)\'/, "\\1‘"], [/(\d+)"/, "\\1′"], [/(\d+)\'/, "\\1″"], [/(\S)\'([^\'\s])/, "\\1’\\2"], [/(\s|\A|\(|\[)"(?!\s)/, "\\1“\\2"], [/"(\s|\S|\Z)/, "”\\1"], [/\'([\s.]|\Z)/, "’\\1"], [/(\d+)x(\d+)/, "\\1×\\2"], [/([a-z])'(t|d|s|ll|re|ve)(\b)/i, "\\1’\\2\\3"] ] end |
.special_cases ⇒ Object
31 32 33 34 |
# File 'lib/titlify/data/word_lists.rb', line 31 def self.special_cases # I bet this is going to get out of control... %w(at(?!&t) v[.]? vs[.]?) end |
.word_list ⇒ Object
36 37 38 |
# File 'lib/titlify/data/word_lists.rb', line 36 def self.word_list Data.articles | Data.coordinating_conjunctions | Data.prepositions | Data.special_cases end |