class Shaf::Yard::ResourceObject

Attributes

profile[RW]

Public Class Methods

path(*args, sep: '::') click to toggle source
# File lib/shaf/yard/resource_object.rb, line 8
def self.path(*args, sep: '::')
  ['Serializers', *args].join(sep)
end

Public Instance Methods

attributes() click to toggle source
# File lib/shaf/yard/resource_object.rb, line 16
def attributes
  children.select { |child| child.type == :attribute }
          .sort_by(&:name)
end
description() click to toggle source
# File lib/shaf/yard/resource_object.rb, line 49
def description
  # TODO: How to add description? @description tag in serializer?
  ''
end
path() click to toggle source
Calls superclass method
# File lib/shaf/yard/resource_object.rb, line 12
def path
  self.class.path(super, sep: sep)
end
profile?() click to toggle source
# File lib/shaf/yard/resource_object.rb, line 35
def profile?
  !!profile
end
profile_name() click to toggle source
# File lib/shaf/yard/resource_object.rb, line 39
def profile_name
  return '' unless profile?

  profile.name
end
profile_objects() click to toggle source
# File lib/shaf/yard/resource_object.rb, line 45
def profile_objects
  @profile_objects ||= []
end
resource_name() click to toggle source
# File lib/shaf/yard/resource_object.rb, line 26
def resource_name
  str = name.to_s.sub(/_?serializer$/i, '')
  return str unless str.match? '_'

  str.split('_')
     .map(&:capitalize)
     .join
end