Class: Bridgetown::Resource::TaxonomyTerm

Inherits:
Object
  • Object
show all
Defined in:
lib/bridgetown-core/resource/taxonomy_term.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource:, label:, type:) ⇒ TaxonomyTerm

Returns a new instance of TaxonomyTerm.



8
9
10
11
12
# File 'lib/bridgetown-core/resource/taxonomy_term.rb', line 8

def initialize(resource:, label:, type:)
  @resource = resource
  @label = label
  @type = type
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



6
7
8
# File 'lib/bridgetown-core/resource/taxonomy_term.rb', line 6

def label
  @label
end

#resourceObject (readonly)

Returns the value of attribute resource.



6
7
8
# File 'lib/bridgetown-core/resource/taxonomy_term.rb', line 6

def resource
  @resource
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/bridgetown-core/resource/taxonomy_term.rb', line 6

def type
  @type
end

Instance Method Details

#as_jsonObject



21
22
23
# File 'lib/bridgetown-core/resource/taxonomy_term.rb', line 21

def as_json(*)
  to_h
end

#to_jsonObject



25
26
27
# File 'lib/bridgetown-core/resource/taxonomy_term.rb', line 25

def to_json(...)
  as_json(...).to_json(...)
end

#to_liquidObject Also known as: to_h



14
15
16
17
18
# File 'lib/bridgetown-core/resource/taxonomy_term.rb', line 14

def to_liquid
  {
    "label" => label,
  }
end