Class: CollectionJson::Serializer::Items

Inherits:
Object
  • Object
show all
Defined in:
lib/collection_json_serializer/items.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributes(*args) ⇒ Object

Returns the value of attribute attributes.



5
6
7
# File 'lib/collection_json_serializer/items.rb', line 5

def attributes
  @attributes
end

#href(*args) ⇒ Object

Returns the value of attribute href.



4
5
6
# File 'lib/collection_json_serializer/items.rb', line 4

def href
  @href
end

Returns the value of attribute links.



6
7
8
# File 'lib/collection_json_serializer/items.rb', line 6

def links
  @links
end

Instance Method Details

#attribute(args) ⇒ Object



21
22
23
24
# File 'lib/collection_json_serializer/items.rb', line 21

def attribute(args)
  @attributes = Array.new unless @attributes.is_a?(Array)
  @attributes << args
end

#attributes?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/collection_json_serializer/items.rb', line 39

def attributes?
  @attributes.present?
end

#href?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/collection_json_serializer/items.rb', line 35

def href?
  @href.present?
end


26
27
28
29
# File 'lib/collection_json_serializer/items.rb', line 26

def link(args)
  @links = Array.new unless @links.is_a?(Array)
  @links << args
end

#links?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/collection_json_serializer/items.rb', line 43

def links?
  @links.present?
end