Class: RubyRailsExtensions::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-rails-extensions.rb

Constant Summary collapse

BOOLEAN_GEMS =
%i[
  all_keys
  all_values
  any_key
  any_value
  boolean_scope
  compact_map
  compact_blank_join
  current_day
  current_month
  current_week
  cutoff
  day_of_week
  display_military
  display_user
  find_bang
  find_dupes
  first_dupe
  flatten_compact
  google_format
  hash_only
  humanize_symbol
  in_utc
  input
  invert_with_dups
  left_deep_merge
  month_and_year
  month_year
  nmerge
  no_keys
  no_values
  only_some
  overlaps
  pipe
  presence_bang
  quarter_dates
  quarter_str
  range_add
  range_comparisons
  range_multiply
  range_round
  range_subtract
  remove_reserved_keywords
  safe_parse
  select_present
  select_present_join
  set_to_sentence
  to_bool
  to_d
  to_dec
  to_delimited
  to_i
  to_local
  to_money
  to_negative_i
  to_new_date
  to_new_time
  to_nonzero_i
  to_or_sentence
  to_percentage
  to_positive_i
  to_sort_i
  to_x
  todays_date
  uniq_map
  usd_to_f
  usd_to_i
  utf8_encode
  weighted_sum
  word_wrap
  yesno
  zero_range
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Sets all flags to true by default



101
102
103
104
105
106
107
108
109
# File 'lib/ruby-rails-extensions.rb', line 101

def initialize
  super

  BOOLEAN_GEMS.each do |extension_name|
    include_extension = flag_name(extension_name)

    public_send(:"#{include_extension}=", true)
  end
end

Instance Attribute Details

#default_time_zoneObject

Returns the value of attribute default_time_zone.



83
84
85
# File 'lib/ruby-rails-extensions.rb', line 83

def default_time_zone
  @default_time_zone
end

Class Method Details

.flag_name(gem_base) ⇒ Symbol

Returns the flag name.

Returns:



86
87
88
# File 'lib/ruby-rails-extensions.rb', line 86

def self.flag_name(gem_base)
  :"include_#{gem_base}"
end

Instance Method Details

#flagsArray<Symbol>

Returns:



112
113
114
# File 'lib/ruby-rails-extensions.rb', line 112

def flags
  BOOLEAN_GEMS.map { |f| flag_name(f) }
end