hateda2md 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -50,12 +50,13 @@ class HateDa::MdBuilder
50
50
  end
51
51
  end
52
52
 
53
- def save_to_files(dir='md', ext='md')
53
+ def save_to_files(opt={})
54
+ opt = {dir:'md', ext:'md'}.update(opt)
54
55
  md_entries = entries.select { |ent| ent.ent_mdbody }
55
56
  unless md_entries.empty?
56
- Dir.mkdir(dir) unless Dir.exist?(dir)
57
+ Dir.mkdir(opt[:dir]) unless Dir.exist?(opt[:dir])
57
58
  md_entries.each do |ent|
58
- path = "#{dir}/#{ent.ent_date}-#{title_for_file(ent.ent_title)}.#{ext}"
59
+ path = "#{opt[:dir]}/#{ent.ent_date}-#{title_for_file(ent.ent_title)}.#{opt[:ext]}"
59
60
  File.open(path, 'w') do |f|
60
61
  f.puts header(ent.ent_title, ent.ent_date)
61
62
  f.puts ent.ent_mdbody
@@ -1,3 +1,3 @@
1
1
  module Hateda2md
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hateda2md
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-05-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2153771040 !ruby/object:Gem::Requirement
16
+ requirement: &2160489100 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2153771040
24
+ version_requirements: *2160489100
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nokogiri
27
- requirement: &2153770580 !ruby/object:Gem::Requirement
27
+ requirement: &2160488640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153770580
35
+ version_requirements: *2160488640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: gsub_filter
38
- requirement: &2153770160 !ruby/object:Gem::Requirement
38
+ requirement: &2160488220 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2153770160
46
+ version_requirements: *2160488220
47
47
  description: Convert Hatena-Diary XML file to Markdown files for Jekyll
48
48
  email:
49
49
  - postagie@gmail.com