Module: ArcWeld::Relationships::InCategory
- Defined in:
- lib/arc_weld/relationships/in_category.rb
Instance Method Summary collapse
- #add_categories(*cats) ⇒ Object
- #add_category(cat) ⇒ Object
- #add_category_uri(uri) ⇒ Object
- #in_category_relationship ⇒ Object
- #related_in_category_references ⇒ Object
Instance Method Details
#add_categories(*cats) ⇒ Object
19 20 21 |
# File 'lib/arc_weld/relationships/in_category.rb', line 19 def add_categories(*cats) cats.each { |cat| add_category(cat) } end |
#add_category(cat) ⇒ Object
13 14 15 16 17 |
# File 'lib/arc_weld/relationships/in_category.rb', line 13 def add_category(cat) unless in_category.include?(cat.ref) in_category << cat.ref end end |
#add_category_uri(uri) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/arc_weld/relationships/in_category.rb', line 5 def add_category_uri(uri) if (uri.match(%r{\A/All Asset Categories/})) ref = ArcWeld::Reference.new(type: 'Group', uri: uri) add_category(ref) end # silent fail? end |
#in_category_relationship ⇒ Object
27 28 29 30 31 |
# File 'lib/arc_weld/relationships/in_category.rb', line 27 def in_category_relationship unless in_category.empty? { 'inCategory' => { 'list!' => } } end end |
#related_in_category_references ⇒ Object
23 24 25 |
# File 'lib/arc_weld/relationships/in_category.rb', line 23 def (in_category.map &:render).join end |