Class: Accessionable::Base::Tag

Inherits:
Object
  • Object
show all
Defined in:
app/models/accessionable/base.rb

Overview

rubocop:todo Style/Documentation

Direct Known Subclasses

ArrayExpressTag, EgaTag

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label_scope, name, value, downcase = false) ⇒ Tag

Returns a new instance of Tag.


82
83
84
85
86
# File 'app/models/accessionable/base.rb', line 82

def initialize(label_scope, name, value, downcase = false)
  @name = name
  @value = downcase && value ? value.downcase : value
  @scope = label_scope
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value


80
81
82
# File 'app/models/accessionable/base.rb', line 80

def value
  @value
end

Instance Method Details

#build(xml) ⇒ Object


92
93
94
95
# File 'app/models/accessionable/base.rb', line 92

def build(xml)
  xml.TAG   label
  xml.VALUE value
end

#labelObject


88
89
90
# File 'app/models/accessionable/base.rb', line 88

def label
  I18n.t("#{@scope}.#{@name}.label").tr(' ', '_').downcase
end