Class: Shaf::Yard::ResourceObject
- Inherits:
-
YARD::CodeObjects::ClassObject
- Object
- YARD::CodeObjects::ClassObject
- Shaf::Yard::ResourceObject
- Defined in:
- lib/shaf/yard/resource_object.rb
Instance Attribute Summary collapse
-
#profile ⇒ Object
Returns the value of attribute profile.
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Object
- #description ⇒ Object
- #links ⇒ Object
- #path ⇒ Object
- #profile? ⇒ Boolean
- #profile_name ⇒ Object
- #profile_objects ⇒ Object
- #resource_name ⇒ Object
Instance Attribute Details
#profile ⇒ Object
Returns the value of attribute profile.
6 7 8 |
# File 'lib/shaf/yard/resource_object.rb', line 6 def profile @profile end |
Class Method Details
.path(*args, sep: '::') ⇒ Object
8 9 10 |
# File 'lib/shaf/yard/resource_object.rb', line 8 def self.path(*args, sep: '::') ['Serializers', *args].join(sep) end |
Instance Method Details
#attributes ⇒ Object
16 17 18 19 |
# File 'lib/shaf/yard/resource_object.rb', line 16 def attributes children.select { |child| child.type == :attribute } .sort_by(&:name) end |
#description ⇒ Object
49 50 51 52 |
# File 'lib/shaf/yard/resource_object.rb', line 49 def description # TODO: How to add description? @description tag in serializer? '' end |
#links ⇒ Object
21 22 23 24 |
# File 'lib/shaf/yard/resource_object.rb', line 21 def links children.select { |child| child.type == :link } .sort_by(&:name) end |
#path ⇒ Object
12 13 14 |
# File 'lib/shaf/yard/resource_object.rb', line 12 def path self.class.path(super, sep: sep) end |
#profile? ⇒ Boolean
35 36 37 |
# File 'lib/shaf/yard/resource_object.rb', line 35 def profile? !!profile end |
#profile_name ⇒ Object
39 40 41 42 43 |
# File 'lib/shaf/yard/resource_object.rb', line 39 def profile_name return '' unless profile? profile.name end |
#profile_objects ⇒ Object
45 46 47 |
# File 'lib/shaf/yard/resource_object.rb', line 45 def profile_objects @profile_objects ||= [] end |
#resource_name ⇒ Object
26 27 28 29 30 31 32 33 |
# 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 |