Module: Mkmatter::Common
- Included in:
- Questions::Page, Questions::Post
- Defined in:
- lib/mkmatter/common.rb
Instance Attribute Summary collapse
-
#time_zone ⇒ Object
Returns the value of attribute time_zone.
Instance Method Summary collapse
- #get_001_title(hl) ⇒ String
- #get_002_tags(hl) ⇒ String
- #get_003_categories(hl) ⇒ String
- #get_004_time_zone(hl) ⇒ String
- #get_005_file_format(hl) ⇒ String
Instance Attribute Details
#time_zone ⇒ Object
Returns the value of attribute time_zone.
6 7 8 |
# File 'lib/mkmatter/common.rb', line 6 def time_zone @time_zone end |
Instance Method Details
#get_001_title(hl) ⇒ String
9 10 11 12 13 14 15 16 |
# File 'lib/mkmatter/common.rb', line 9 def get_001_title(hl) title = hl.ask 'Title: ' if hl.agree("Would you like it 'titleized' (Title instead of title)? ", true) title.titleize else title end end |
#get_002_tags(hl) ⇒ String
20 21 22 |
# File 'lib/mkmatter/common.rb', line 20 def (hl) hl.ask 'Tags? (this would be a comma separated list.) ', -> (str) {str.split(',')} end |
#get_003_categories(hl) ⇒ String
26 27 28 |
# File 'lib/mkmatter/common.rb', line 26 def get_003_categories(hl) hl.ask 'Categories? (space separated list) ', -> (str) {str.split(' ')} end |
#get_004_time_zone(hl) ⇒ String
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/mkmatter/common.rb', line 32 def get_004_time_zone(hl) custom = nil timezone = hl.choose do |m| m.header = 'Time Zone? (select by number)' m.choice('Eastern Time (US & Canada)') do return 'Eastern Time (US & Canada)' end m.choice('Central Time (US & Canada)') do return 'Central Time (US & Canada)' end m.choice :neither m.prompt = '? ' end case when timezone == :neither custom = hl.ask('Other Time Zone: ', String) end if custom hl.say('Checking TimeZone Validity') print '.' sleep(0.05) 5.times do print '.' sleep(0.05) puts '' TimeZone.find_tzinfo custom end custom end end |
#get_005_file_format(hl) ⇒ String
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/mkmatter/common.rb', line 65 def get_005_file_format(hl) hl.choose do || .header = 'Choose whether you want HTML or Markdown' .choice 'html' do return 'html' end .choice 'md' do return 'md' end .prompt = '? ' end end |