Class: Accessionable::Base::Tag

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

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


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

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


77
78
79
# File 'app/models/accessionable/base.rb', line 77

def value
  @value
end

Instance Method Details

#build(xml) ⇒ Object


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

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

#labelObject


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

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