Class: Staticky::Generator::ViewContext

Inherits:
Object
  • Object
show all
Defined in:
lib/staticky/generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, title: "", description: "", twitter: "") ⇒ ViewContext

Returns a new instance of ViewContext.

Raises:

  • (ArgumentError)


10
11
12
13
14
15
16
17
# File 'lib/staticky/generator.rb', line 10

def initialize(url:, title: "", description: "", twitter: "")
  @title = title
  @description = description
  @twitter = twitter
  @url = URI(url)

  raise ArgumentError, "Must be a full url: #{@url}" unless @url.host
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'lib/staticky/generator.rb', line 8

def description
  @description
end

#titleObject (readonly)

Returns the value of attribute title.



8
9
10
# File 'lib/staticky/generator.rb', line 8

def title
  @title
end

#twitterObject (readonly)

Returns the value of attribute twitter.



8
9
10
# File 'lib/staticky/generator.rb', line 8

def twitter
  @twitter
end

#urlObject (readonly)

Returns the value of attribute url.



8
9
10
# File 'lib/staticky/generator.rb', line 8

def url
  @url
end