Class: Selfiegram::Runner::Options
- Includes:
- Enumerable
- Defined in:
- lib/runner/options/options.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#background_image_path ⇒ Object
Returns the value of attribute background_image_path.
-
#image ⇒ Object
Returns the value of attribute image.
-
#magic ⇒ Object
Returns the value of attribute magic.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
-
#selfiegram_path ⇒ Object
Returns the value of attribute selfiegram_path.
-
#user ⇒ Object
Returns the value of attribute user.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(options = {}) ⇒ Options
constructor
A new instance of Options.
- #to_h ⇒ Object
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(={}) @user = pathify [:user] @magic = [:magic] || "" @action = [:action] || :snap @image = [:image] @verbose = [:verbose] @selfiegram_path = [:path] || default_selfiegram_path @output_path = default_output_path([:output]) @background_image_path = default_background_image_path end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
5 6 7 |
# File 'lib/runner/options/options.rb', line 5 def action @action end |
#background_image_path ⇒ Object
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 |
#image ⇒ Object
Returns the value of attribute image.
5 6 7 |
# File 'lib/runner/options/options.rb', line 5 def image @image end |
#magic ⇒ Object
Returns the value of attribute magic.
5 6 7 |
# File 'lib/runner/options/options.rb', line 5 def magic @magic end |
#output_path ⇒ Object
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_path ⇒ Object
Returns the value of attribute selfiegram_path.
5 6 7 |
# File 'lib/runner/options/options.rb', line 5 def selfiegram_path @selfiegram_path end |
#user ⇒ Object
Returns the value of attribute user.
5 6 7 |
# File 'lib/runner/options/options.rb', line 5 def user @user end |
#verbose ⇒ Object
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_h ⇒ Object
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 |