Class: AocCli::Commands::OpenReddit
- Inherits:
-
Object
- Object
- AocCli::Commands::OpenReddit
- Defined in:
- lib/aoc_cli/commands.rb
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#day ⇒ Object
readonly
Returns the value of attribute day.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
- #defaults ⇒ Object
- #exec ⇒ Object
-
#initialize(args) ⇒ OpenReddit
constructor
A new instance of OpenReddit.
Constructor Details
#initialize(args) ⇒ OpenReddit
86 87 88 89 90 91 |
# File 'lib/aoc_cli/commands.rb', line 86 def initialize(args) args = defaults.merge(args).compact @year = Validate.year(args[:year]) @day = Validate.day(args[:day]) @browser = args[:browser] end |
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
85 86 87 |
# File 'lib/aoc_cli/commands.rb', line 85 def browser @browser end |
#day ⇒ Object (readonly)
Returns the value of attribute day.
85 86 87 |
# File 'lib/aoc_cli/commands.rb', line 85 def day @day end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
85 86 87 |
# File 'lib/aoc_cli/commands.rb', line 85 def year @year end |
Instance Method Details
#defaults ⇒ Object
96 97 98 99 100 |
# File 'lib/aoc_cli/commands.rb', line 96 def defaults { year:Metafile.get(:year), day:Metafile.get(:day), browser:Prefs.bool(key:"reddit_in_browser") } end |
#exec ⇒ Object
92 93 94 95 |
# File 'lib/aoc_cli/commands.rb', line 92 def exec Tools::Reddit.new(y:year, d:day, b:browser).open self end |