Class: RelatonIeee::BallotingGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton_ieee/balloting_group.rb

Constant Summary collapse

TYPES =
%w[individual entity].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, content:) ⇒ BallotingGroup

Initialize balloting group

Parameters:

  • type (String)

    type

  • content (String)

    content



14
15
16
17
18
19
20
21
# File 'lib/relaton_ieee/balloting_group.rb', line 14

def initialize(type:, content:)
  unless TYPES.include?(type)
    Util.warn "type of Balloting group must be one of `#{TYPES.join('`, `')}`"
  end

  @type = type
  @content = content
end

Instance Attribute Details

#contentString (readonly)

Returns:

  • (String)


6
7
8
# File 'lib/relaton_ieee/balloting_group.rb', line 6

def content
  @content
end

#typeString (readonly)

Returns:

  • (String)


6
7
8
# File 'lib/relaton_ieee/balloting_group.rb', line 6

def type
  @type
end

Instance Method Details

#to_asciibib(prefix = "") ⇒ String

Render balloting group to AsciiBib

Parameters:

  • prefix (String) (defaults to: "")

    Prefix

Returns:

  • (String)

    AsciiBib



48
49
50
51
52
53
54
# File 'lib/relaton_ieee/balloting_group.rb', line 48

def to_asciibib(prefix = "")
  pref = prefix.empty? ? prefix : "#{prefix}."
  pref += "balloting-group"
  out = "#{pref}.type:: #{type}\n"
  out += "#{pref}.content:: #{content}\n"
  out
end

#to_hashHash

Render balloting group to Hash

Returns:

  • (Hash)

    balloting group as Hash



37
38
39
# File 'lib/relaton_ieee/balloting_group.rb', line 37

def to_hash
  { "type" => type, "content" => content }
end

#to_xml(builder) ⇒ Object

Render balloting group to XML

Parameters:

  • builder (Nokogiri::XML::Builder)

    XML builder



28
29
30
# File 'lib/relaton_ieee/balloting_group.rb', line 28

def to_xml(builder)
  builder.send :"balloting-group", content, type: type
end