Module: Contentful::Resource::Fields
- Included in:
- Entry
- Defined in:
- lib/contentful/resource/fields.rb
Overview
Include this module into your Resource class to enable it to deal with entry fields (but not asset fields)
It depends on system properties being available
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#fields ⇒ Object
Returns all fields of the asset.
- #initialize(object) ⇒ Object
- #inspect(info = nil) ⇒ Object
Class Method Details
.included(base) ⇒ Object
34 35 36 |
# File 'lib/contentful/resource/fields.rb', line 34 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#fields ⇒ Object
Returns all fields of the asset
9 10 11 |
# File 'lib/contentful/resource/fields.rb', line 9 def fields @fields[locale] end |
#initialize(object) ⇒ Object
13 14 15 16 17 |
# File 'lib/contentful/resource/fields.rb', line 13 def initialize(object, *) super @fields = {} @fields[locale] = extract_from_object object["fields"], :fields end |
#inspect(info = nil) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/contentful/resource/fields.rb', line 19 def inspect(info = nil) if fields.empty? super(info) else super("#{info} @fields=#{fields.inspect}") end end |