Class: LinkShrink::Options
- Inherits:
-
Hash
- Object
- Hash
- LinkShrink::Options
- Defined in:
- lib/link_shrink/options.rb
Overview
Inherits from Hash to add predicate methods
Instance Method Summary collapse
-
#initialize(*args) ⇒ Options
constructor
A new instance of Options.
-
#method ⇒ Trueclass
Dynamically defines three predicate methods.
Constructor Details
#initialize(*args) ⇒ Options
Returns a new instance of Options.
5 6 7 8 |
# File 'lib/link_shrink/options.rb', line 5 def initialize(*args) super(*args) self.merge!(self.default) end |
Instance Method Details
#method ⇒ Trueclass
Dynamically defines three predicate methods
12 13 14 15 16 |
# File 'lib/link_shrink/options.rb', line 12 [:qr_code, :json, :image_size].map do |method| define_method "#{method}?" do self.fetch(method, false) end end |