Class: Selfiegram::Runner::Options

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/runner/options/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Options

Returns a new instance of Options.



8
9
10
11
12
13
14
15
16
17
# File 'lib/runner/options/options.rb', line 8

def initialize(options={})
  @user                  = pathify options[:user]
  @magic                 = options[:magic]  || ""
  @action                = options[:action] || :snap
  @image                 = options[:image]
  @verbose               = options[:verbose]
  @selfiegram_path       = options[:path]   || default_selfiegram_path
  @output_path           = default_output_path(options[:output])
  @background_image_path = default_background_image_path
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



5
6
7
# File 'lib/runner/options/options.rb', line 5

def action
  @action
end

#background_image_pathObject

Returns the value of attribute background_image_path.



5
6
7
# File 'lib/runner/options/options.rb', line 5

def background_image_path
  @background_image_path
end

#imageObject

Returns the value of attribute image.



5
6
7
# File 'lib/runner/options/options.rb', line 5

def image
  @image
end

#magicObject

Returns the value of attribute magic.



5
6
7
# File 'lib/runner/options/options.rb', line 5

def magic
  @magic
end

#output_pathObject

Returns the value of attribute output_path.



5
6
7
# File 'lib/runner/options/options.rb', line 5

def output_path
  @output_path
end

#selfiegram_pathObject

Returns the value of attribute selfiegram_path.



5
6
7
# File 'lib/runner/options/options.rb', line 5

def selfiegram_path
  @selfiegram_path
end

#userObject

Returns the value of attribute user.



5
6
7
# File 'lib/runner/options/options.rb', line 5

def user
  @user
end

#verboseObject

Returns the value of attribute verbose.



5
6
7
# File 'lib/runner/options/options.rb', line 5

def verbose
  @verbose
end

Instance Method Details

#each(&block) ⇒ Object



27
28
29
# File 'lib/runner/options/options.rb', line 27

def each(&block)
  to_h.each(&block)
end

#to_hObject



19
20
21
22
23
24
25
# File 'lib/runner/options/options.rb', line 19

def to_h
  instance_variables.inject({}) do |hash, var_name|
    getter       = var_name.to_s[1..-1].to_sym
    hash[getter] = send(getter)
    hash
  end
end