Class: JekyllOgImage::Configuration
- Inherits:
-
Object
- Object
- JekyllOgImage::Configuration
show all
- Defined in:
- lib/jekyll_og_image/configuration.rb
Overview
Defined Under Namespace
Classes: Border, Canvas, Content, Header, Image, Metadata
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Configuration.
43
44
45
|
# File 'lib/jekyll_og_image/configuration.rb', line 43
def initialize(raw_config)
@raw_config = raw_config
end
|
Instance Method Details
#==(other) ⇒ Object
60
61
62
|
# File 'lib/jekyll_og_image/configuration.rb', line 60
def ==(other)
to_h == other.to_h
end
|
#border_bottom ⇒ Object
115
116
117
|
# File 'lib/jekyll_og_image/configuration.rb', line 115
def border_bottom
@raw_config["border_bottom"] ? Border.new(**Jekyll::Utils.symbolize_hash_keys(@raw_config["border_bottom"])) : nil
end
|
#canvas ⇒ Object
88
89
90
|
# File 'lib/jekyll_og_image/configuration.rb', line 88
def canvas
@raw_config["canvas"] ? Canvas.new(**Jekyll::Utils.symbolize_hash_keys(@raw_config["canvas"])) : Canvas.new
end
|
#collections ⇒ Object
64
65
66
|
# File 'lib/jekyll_og_image/configuration.rb', line 64
def collections
@raw_config["collections"] || [ "posts" ]
end
|
#content ⇒ Object
96
97
98
|
# File 'lib/jekyll_og_image/configuration.rb', line 96
def content
@raw_config["content"] ? Content.new(**Jekyll::Utils.symbolize_hash_keys(@raw_config["content"])) : Content.new
end
|
#domain ⇒ Object
111
112
113
|
# File 'lib/jekyll_og_image/configuration.rb', line 111
def domain
@raw_config["domain"]
end
|
#enabled? ⇒ Boolean
68
69
70
|
# File 'lib/jekyll_og_image/configuration.rb', line 68
def enabled?
@raw_config["enabled"].nil? ? true : @raw_config["enabled"]
end
|
#force? ⇒ Boolean
76
77
78
|
# File 'lib/jekyll_og_image/configuration.rb', line 76
def force?
@raw_config["force"].nil? ? false : @raw_config["force"]
end
|
92
93
94
|
# File 'lib/jekyll_og_image/configuration.rb', line 92
def
@raw_config["header"] ? .new(**Jekyll::Utils.symbolize_hash_keys(@raw_config["header"])) : .new
end
|
#image ⇒ Object
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/jekyll_og_image/configuration.rb', line 100
def image
if @raw_config["image"].is_a?(String)
Image.new(path: @raw_config["image"])
elsif @raw_config["image"]
Image.new(**Jekyll::Utils.symbolize_hash_keys(@raw_config["image"]))
else
Image.new
end
end
|
#margin_bottom ⇒ Object
119
120
121
|
# File 'lib/jekyll_og_image/configuration.rb', line 119
def margin_bottom
80 + (border_bottom&.width || 0)
end
|
#merge!(other) ⇒ Object
47
48
49
50
51
52
53
54
|
# File 'lib/jekyll_og_image/configuration.rb', line 47
def merge!(other)
config = Jekyll::Utils.deep_merge_hashes(
@raw_config,
other.to_h
)
self.class.new(config)
end
|
124
125
126
|
# File 'lib/jekyll_og_image/configuration.rb', line 124
def metadata
@raw_config["metadata"] ? Metadata.new(**Jekyll::Utils.symbolize_hash_keys(@raw_config["metadata"])) : Metadata.new
end
|
#output_dir ⇒ Object
72
73
74
|
# File 'lib/jekyll_og_image/configuration.rb', line 72
def output_dir
@raw_config["output_dir"] || "assets/images/og"
end
|
#skip_drafts? ⇒ Boolean
84
85
86
|
# File 'lib/jekyll_og_image/configuration.rb', line 84
def skip_drafts?
@raw_config["skip_drafts"].nil? ? true : @raw_config["skip_drafts"]
end
|
#to_h ⇒ Object
56
57
58
|
# File 'lib/jekyll_og_image/configuration.rb', line 56
def to_h
@raw_config
end
|
#verbose? ⇒ Boolean
80
81
82
|
# File 'lib/jekyll_og_image/configuration.rb', line 80
def verbose?
@raw_config["verbose"].nil? ? false : @raw_config["verbose"]
end
|