Module: Ecoportal::API::Common::Content::DoubleModel::Modifiers::ReadOnlyAble::ClassMethods

Defined in:
lib/ecoportal/api/common/content/double_model/modifiers/read_only_able.rb

Instance Method Summary collapse

Instance Method Details

#read_only!Object

Note:

this propagates to all the nested models thereof.

Be able to define if a class should be read-only



34
35
36
# File 'lib/ecoportal/api/common/content/double_model/modifiers/read_only_able.rb', line 34

def read_only!
  @read_only = true
end

#read_only?Boolean

Note:

when defined as root of the model, it isn't read-only

Returns:

  • (Boolean)


25
26
27
28
29
30
# File 'lib/ecoportal/api/common/content/double_model/modifiers/read_only_able.rb', line 25

def read_only?
  @read_only = false if @read_only.nil?
  return false if root?

  @read_only
end