Class: MediumExport::ArticlesFilter
- Inherits:
-
Object
- Object
- MediumExport::ArticlesFilter
- Defined in:
- lib/middleman-medium_export/articles_filter.rb
Instance Attribute Summary collapse
-
#articles ⇒ Object
readonly
Returns the value of attribute articles.
-
#shell ⇒ Object
readonly
Returns the value of attribute shell.
Instance Method Summary collapse
- #all ⇒ Object
-
#initialize(articles:, shell:) ⇒ ArticlesFilter
constructor
A new instance of ArticlesFilter.
- #interactive ⇒ Object
- #last ⇒ Object
Constructor Details
#initialize(articles:, shell:) ⇒ ArticlesFilter
Returns a new instance of ArticlesFilter.
4 5 6 7 |
# File 'lib/middleman-medium_export/articles_filter.rb', line 4 def initialize(articles:, shell:) @articles = articles @shell = shell end |
Instance Attribute Details
#articles ⇒ Object (readonly)
Returns the value of attribute articles.
2 3 4 |
# File 'lib/middleman-medium_export/articles_filter.rb', line 2 def articles @articles end |
#shell ⇒ Object (readonly)
Returns the value of attribute shell.
2 3 4 |
# File 'lib/middleman-medium_export/articles_filter.rb', line 2 def shell @shell end |
Instance Method Details
#all ⇒ Object
13 14 15 |
# File 'lib/middleman-medium_export/articles_filter.rb', line 13 def all articles end |
#interactive ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/middleman-medium_export/articles_filter.rb', line 17 def interactive articles.each_with_object([]) do |article, acc| case ask_to_include(article.title) when 'Y' then acc.push(article) when 'S' then acc.push(article) and break(acc) when 'Q' then break(acc) end end end |
#last ⇒ Object
9 10 11 |
# File 'lib/middleman-medium_export/articles_filter.rb', line 9 def last [articles.first] end |