Class: RicherText::Embed

Inherits:
Object
  • Object
show all
Includes:
Rendering
Defined in:
lib/richer_text/embed.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(embed) ⇒ Embed

Returns a new instance of Embed.



12
13
14
# File 'lib/richer_text/embed.rb', line 12

def initialize(embed)
  @embed = embed
end

Instance Attribute Details

#embedObject (readonly)

Returns the value of attribute embed.



10
11
12
# File 'lib/richer_text/embed.rb', line 10

def embed
  @embed
end

Class Method Details

.find(sgid) ⇒ Object



5
6
7
8
# File 'lib/richer_text/embed.rb', line 5

def self.find(sgid)
  @embed = GlobalID::Locator.locate_signed(sgid, for: "embeddable")
  new(@embed) if @embed
end

Instance Method Details

#htmlObject



23
24
25
# File 'lib/richer_text/embed.rb', line 23

def html
  render partial: to_richer_text_editor_partial_path, object: object, as: model_name.element
end

#objectObject



16
17
18
# File 'lib/richer_text/embed.rb', line 16

def object
  @embed
end