Class: Playbook::PbTime::Time

Inherits:
KitBase
  • Object
show all
Defined in:
app/pb_kits/playbook/pb_time/time.rb

Instance Method Summary collapse

Methods inherited from KitBase

#object

Methods included from NumberSpacing

included

Methods included from ZIndex

included

Methods included from Spacing

included, #max_width_options, #max_width_props, #max_width_values, #spacing_options, #spacing_props, #spacing_values

Methods included from Classnames

#generate_classname, #generate_classname_without_spacing, included

Methods included from Playbook::Props

#initialize, #prop

Methods included from Playbook::PbKitHelper

#pb_rails

Methods included from Playbook::PbFormsHelper

#pb_form_with

Instance Method Details

#classnameObject



19
20
21
22
23
24
25
26
# File 'app/pb_kits/playbook/pb_time/time.rb', line 19

def classname
  # convert deprecated prop values
  mutated_size = size
  mutated_size = "sm" if mutated_size == "xs"
  mutated_size = "md" if mutated_size == "lg"

  generate_classname("pb_time_kit", align, mutated_size)
end

#format_time_stringObject



28
29
30
# File 'app/pb_kits/playbook/pb_time/time.rb', line 28

def format_time_string
  "#{pb_date_time.to_hour}:#{pb_date_time.to_minutes}#{pb_date_time.to_meridian}"
end

#format_timezone_stringObject



32
33
34
# File 'app/pb_kits/playbook/pb_time/time.rb', line 32

def format_timezone_string
  pb_date_time.to_timezone.to_s
end

#pb_date_timeObject



36
37
38
# File 'app/pb_kits/playbook/pb_time/time.rb', line 36

def pb_date_time
  Playbook::PbKit::PbDateTime.new(time, timezone)
end