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

Instance Method Summary collapse

Instance Method Details

#fields(wanted_locale = default_locale) ⇒ Object

Returns all fields of the asset



9
10
11
# File 'lib/contentful/resource/fields.rb', line 9

def fields(wanted_locale = default_locale)
  @fields[locale || wanted_locale]
end

#initialize(object) ⇒ Object



13
14
15
16
# File 'lib/contentful/resource/fields.rb', line 13

def initialize(object, *)
  super
  extract_fields_from_object! object
end

#inspect(info = nil) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/contentful/resource/fields.rb', line 18

def inspect(info = nil)
  if fields.empty?
    super(info)
  else
    super("#{info} @fields=#{fields.inspect}")
  end
end