Class: Slideshow::Opts

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

Instance Method Summary collapse

Instance Method Details

#config_pathObject



115
116
117
# File 'lib/slideshow/cli/opts.rb', line 115

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

#config_path=(value) ⇒ Object



111
112
113
# File 'lib/slideshow/cli/opts.rb', line 111

def config_path=(value)
  @config_path = value
end

#fetch_all=(boolean) ⇒ Object



77
78
79
# File 'lib/slideshow/cli/opts.rb', line 77

def fetch_all=(boolean)
  @fetch_all = boolean
end

#fetch_all?Boolean

Returns:

  • (Boolean)


81
82
83
84
# File 'lib/slideshow/cli/opts.rb', line 81

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

  @fetch_all == true
end

#has_includes?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'lib/slideshow/cli/opts.rb', line 97

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

#header_levelObject



33
34
35
36
# File 'lib/slideshow/cli/opts.rb', line 33

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

  @header_level || 1
end

#header_level=(value) ⇒ Object



29
30
31
# File 'lib/slideshow/cli/opts.rb', line 29

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

#includesObject



92
93
94
95
# File 'lib/slideshow/cli/opts.rb', line 92

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

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

#includes=(value) ⇒ Object



88
89
90
# File 'lib/slideshow/cli/opts.rb', line 88

def includes=(value)
  @includes = value
end

#manifestObject



106
107
108
# File 'lib/slideshow/cli/opts.rb', line 106

def manifest
  @manifest || 's6'
end

#manifest=(value) ⇒ Object



102
103
104
# File 'lib/slideshow/cli/opts.rb', line 102

def manifest=(value)
  @manifest = value
end

#merge_gli_options!(options = {}) ⇒ Object



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

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



123
124
125
# File 'lib/slideshow/cli/opts.rb', line 123

def output_path
  @output_path || '.'
end

#output_path=(value) ⇒ Object



119
120
121
# File 'lib/slideshow/cli/opts.rb', line 119

def output_path=(value)
  @output_path = value
end

#quick_manifestObject



71
72
73
# File 'lib/slideshow/cli/opts.rb', line 71

def quick_manifest
  @quick_manifest || 'welcome'
end

#quick_manifest=(value) ⇒ Object



67
68
69
# File 'lib/slideshow/cli/opts.rb', line 67

def quick_manifest=(value)
  @quick_manifest = value
end

#slide=(boolean) ⇒ Object



38
39
40
# File 'lib/slideshow/cli/opts.rb', line 38

def slide=(boolean)
  @slide = boolean
end

#slide?Boolean

Returns:

  • (Boolean)


42
43
44
45
# File 'lib/slideshow/cli/opts.rb', line 42

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

  @slide == true
end

#takahashi=(boolean) ⇒ Object



47
48
49
# File 'lib/slideshow/cli/opts.rb', line 47

def takahashi=(boolean)
  @takahashi = boolean
end

#takahashi?Boolean

Returns:

  • (Boolean)


51
52
53
54
# File 'lib/slideshow/cli/opts.rb', line 51

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

  @takahashi == true
end

#verbose=(boolean) ⇒ Object

add: alias for debug ??



56
57
58
# File 'lib/slideshow/cli/opts.rb', line 56

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

  @verbose = boolean
end

#verbose?Boolean

Returns:

  • (Boolean)


60
61
62
63
# File 'lib/slideshow/cli/opts.rb', line 60

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

  @verbose == true
end