Class: Slideshow::Opts

Inherits:
Object
  • Object
show all
Defined in:
lib/slideshow/cli/opts.rb

Instance Method Summary collapse

Instance Method Details

#config_pathObject



113
114
115
# File 'lib/slideshow/cli/opts.rb', line 113

def config_path
  @config_path || File.join( Env.home, '.slideshow' )
end

#config_path=(value) ⇒ Object



109
110
111
# File 'lib/slideshow/cli/opts.rb', line 109

def config_path=(value)
  @config_path = value
end

#fetch_all=(boolean) ⇒ Object



75
76
77
# File 'lib/slideshow/cli/opts.rb', line 75

def fetch_all=(boolean)
  @fetch_all = boolean
end

#fetch_all?Boolean

Returns:

  • (Boolean)


79
80
81
82
# File 'lib/slideshow/cli/opts.rb', line 79

def fetch_all?
  return false if @fetch_all.nil?  # default fetch all flag is false

  @fetch_all == true
end

#has_includes?Boolean

Returns:

  • (Boolean)


95
96
97
# File 'lib/slideshow/cli/opts.rb', line 95

def has_includes?
  @includes.nil? ? false : true
end

#header_levelObject



31
32
33
34
# File 'lib/slideshow/cli/opts.rb', line 31

def header_level
  ## todo: check   0 is not nil?

  @header_level || 1
end

#header_level=(value) ⇒ Object



27
28
29
# File 'lib/slideshow/cli/opts.rb', line 27

def header_level=(value)
  @header_level = value.to_i
end

#includesObject



90
91
92
93
# File 'lib/slideshow/cli/opts.rb', line 90

def includes
  # fix: use os-agnostic delimiter (use : for Mac/Unix?)

  @includes.nil? ? [] : @includes.split( ';' )
end

#includes=(value) ⇒ Object



86
87
88
# File 'lib/slideshow/cli/opts.rb', line 86

def includes=(value)
  @includes = value
end

#manifestObject



104
105
106
# File 'lib/slideshow/cli/opts.rb', line 104

def manifest
  @manifest || 's6'
end

#manifest=(value) ⇒ Object



100
101
102
# File 'lib/slideshow/cli/opts.rb', line 100

def manifest=(value)
  @manifest = value
end

#merge_gli_options!(options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/slideshow/cli/opts.rb', line 6

def merge_gli_options!( options={} )
  @header_level = 1   if options[:h1] == true
  @header_level = 2   if options[:h2] == true
  
  @slide     = true   if options[:slide] == true
  @takahashi = true   if options[:slide] == true
  
  @verbose = true     if options[:verbose] == true
  
  @fetch_all = true   if options[:all] == true
  
  @config_path = options[:config]    if options[:config].present?
  @output_path = options[:output]    if options[:output].present?
  
  @manifest       =   options[:template]  if options[:template].present?
  
  ## NB: will use :template option too

  @quick_manifest =   options[:template]  if options[:template].present?
end

#output_pathObject



121
122
123
# File 'lib/slideshow/cli/opts.rb', line 121

def output_path
  @output_path || '.'
end

#output_path=(value) ⇒ Object



117
118
119
# File 'lib/slideshow/cli/opts.rb', line 117

def output_path=(value)
  @output_path = value
end

#quick_manifestObject



69
70
71
# File 'lib/slideshow/cli/opts.rb', line 69

def quick_manifest
  @quick_manifest || 'welcome'
end

#quick_manifest=(value) ⇒ Object



65
66
67
# File 'lib/slideshow/cli/opts.rb', line 65

def quick_manifest=(value)
  @quick_manifest = value
end

#slide=(boolean) ⇒ Object



36
37
38
# File 'lib/slideshow/cli/opts.rb', line 36

def slide=(boolean)
  @slide = boolean
end

#slide?Boolean

Returns:

  • (Boolean)


40
41
42
43
# File 'lib/slideshow/cli/opts.rb', line 40

def slide?
  return false if @slide.nil?   # default slide flag is false

  @slide == true
end

#takahashi=(boolean) ⇒ Object



45
46
47
# File 'lib/slideshow/cli/opts.rb', line 45

def takahashi=(boolean)
  @takahashi = boolean
end

#takahashi?Boolean

Returns:

  • (Boolean)


49
50
51
52
# File 'lib/slideshow/cli/opts.rb', line 49

def takahashi?
  return false if @takahashi.nil?   # default takahashi flag is false

  @takahashi == true
end

#verbose=(boolean) ⇒ Object

add: alias for debug ??



54
55
56
# File 'lib/slideshow/cli/opts.rb', line 54

def verbose=(boolean)   # add: alias for debug ??

  @verbose = boolean
end

#verbose?Boolean

Returns:

  • (Boolean)


58
59
60
61
# File 'lib/slideshow/cli/opts.rb', line 58

def verbose?
  return false if @verbose.nil?   # default verbose/debug flag is false

  @verbose == true
end