Method: Imageomatic::Opengraph::Base#initialize

Defined in:
app/models/imageomatic/opengraph/base.rb

#initialize(**kwargs) ⇒ Base

Allows for the object to be initialized with args like ‘Image.new(url: “”, alt: “Logo image”)`.



21
22
23
24
25
26
27
# File 'app/models/imageomatic/opengraph/base.rb', line 21

def initialize(**kwargs)
  kwargs.each do |kwarg, value|
    self.send("#{kwarg}=", value)
  rescue NoMethodError
    raise NoMethodError, "#{kwarg.inspect} is not a property of #{self.inspect}"
  end
end