Class: ProjectSetting

Inherits:
ApplicationRecord show all
Defined in:
app/models/project_setting.rb

Constant Summary collapse

ALLOWED_TARGET_PLATFORMS =
%w(ios osx tvos watchos android).freeze

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Instance Method Summary collapse

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from SensitiveSerializableHash

#serializable_hash

Instance Method Details

#human_squash_optionObject


39
40
41
42
43
44
45
46
# File 'app/models/project_setting.rb', line 39

def human_squash_option
  case squash_option
  when 'never' then 'Do not allow'
  when 'always' then 'Require'
  when 'default_on' then 'Encourage'
  when 'default_off' then 'Allow'
  end
end

#squash_enabled_by_default?Boolean

Returns:

  • (Boolean)

27
28
29
# File 'app/models/project_setting.rb', line 27

def squash_enabled_by_default?
  %w[always default_on].include?(squash_option)
end

#squash_readonly?Boolean

Returns:

  • (Boolean)

31
32
33
# File 'app/models/project_setting.rb', line 31

def squash_readonly?
  %w[always never].include?(squash_option)
end

#target_platforms=(val) ⇒ Object


35
36
37
# File 'app/models/project_setting.rb', line 35

def target_platforms=(val)
  super(val&.map(&:to_s)&.sort)
end