Class: RelatonIeee::BallotingGroup
- Inherits:
-
Object
- Object
- RelatonIeee::BallotingGroup
- Defined in:
- lib/relaton_ieee/balloting_group.rb
Constant Summary collapse
- TYPES =
%w[individual entity].freeze
Instance Attribute Summary collapse
- #content ⇒ String readonly
- #type ⇒ String readonly
Instance Method Summary collapse
-
#initialize(type:, content:) ⇒ BallotingGroup
constructor
Initialize balloting group.
-
#to_asciibib(prefix = "") ⇒ String
Render balloting group to AsciiBib.
-
#to_hash ⇒ Hash
Render balloting group to Hash.
-
#to_xml(builder) ⇒ Object
Render balloting group to XML.
Constructor Details
#initialize(type:, content:) ⇒ BallotingGroup
Initialize balloting group
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
#content ⇒ String (readonly)
6 7 8 |
# File 'lib/relaton_ieee/balloting_group.rb', line 6 def content @content end |
#type ⇒ String (readonly)
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
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_hash ⇒ Hash
Render balloting group to 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
28 29 30 |
# File 'lib/relaton_ieee/balloting_group.rb', line 28 def to_xml(builder) builder.send :"balloting-group", content, type: type end |