Class: QiitaMatome::Core
- Inherits:
-
Object
- Object
- QiitaMatome::Core
- Defined in:
- lib/qiita_matome_core.rb
Overview
QiitaMatome Core
Constant Summary collapse
- QIITA_MATOME_FILE =
'Qiitamatomefile'- QIITA_MATOME_TEMPLATE =
rubocop:disable LineLength
<<-EOS # encoding: utf-8 # Set your qiita user name # user is required # user allow only String user "your value" # Set your matome target tag name # tag is required # tag allow only String tag "your value" # Set your matome title # title is required # title allow only String title "your value" # Set your matome file's output path # output_file is required # output_file allow only String # output_file's default value => "matome.md" output_file "matome.md" # Set your matome sort type. you can choose created_at_asc/desc, updated_at_asc/desc, title_asc/desc, stock_count_asc/desc # sort_type allow only String # sort_type's default value => "created_at_desc" sort_type "created_at_desc" # Set your matome display columns. you can choose :title, :created_at, :updated_at, :stock_count and :no # display_columns allow only Array # display_columns's default value => [:no, :title, :created_at, :stock_count] display_columns [:no, :title, :created_at, :stock_count] # Set your matome exclude files # excludes allow only Array[String, String ...] # String is uuid. For example, 'edbfecb6a6789dd54f47' # excludes's default value => [] excludes [] EOS
Instance Method Summary collapse
-
#init ⇒ Object
Generate Qiitamatomefile to current directory.
-
#matome ⇒ Object
Generate QiitaMatome markdown file.
Instance Method Details
#init ⇒ Object
Generate Qiitamatomefile to current directory.
59 60 61 |
# File 'lib/qiita_matome_core.rb', line 59 def init File.open(QIITA_MATOME_FILE, 'w') { |f|f.puts QIITA_MATOME_TEMPLATE } end |
#matome ⇒ Object
Generate QiitaMatome markdown file.
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/qiita_matome_core.rb', line 64 def matome dsl = read_dsl articles = read_articles(dsl) excluded_articles = read_excluded_articles(dsl, articles) sorted_articles = read_sorted_articles(dsl, excluded_articles) title = dsl.qiita_matome.title display_columns = dsl.qiita_matome.display_columns markdown = read_markdown(sorted_articles, title, display_columns) output_file = dsl.qiita_matome.output_file fw = QiitaMatome::FileWriter.new(output_file, markdown) fw.write end |