Class: Playbook::PbInput::Input

Inherits:
Playbook::PbKit::Base show all
Defined in:
app/pb_kits/playbook/pb_input/input.rb

Constant Summary collapse

PROPS =
%i[configured_aria
configured_classname
configured_data
configured_id
configured_name
configured_label
configured_placeholder
configured_type
configured_value].freeze

Instance Method Summary collapse

Methods inherited from Playbook::PbKit::Base

#adjusted_value, #aria, #classname, #concat_value, #data, #default_value, #false_value, #id, #is_boolean?, #is_integer?, #is_set?, #is_string?, #is_true?, #merge_value, #one_of?, #one_of_value, #true_value

Constructor Details

#initialize(aria: default_configuration, classname: default_configuration, data: default_configuration, id: default_configuration, name: default_configuration, label: default_configuration, placeholder: default_configuration, type: default_configuration, value: default_configuration) ⇒ Input

Returns a new instance of Input.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/pb_kits/playbook/pb_input/input.rb', line 16

def initialize(aria: default_configuration,
               classname: default_configuration,
               data: default_configuration,
               id: default_configuration,
               name: default_configuration,
               label: default_configuration,
               placeholder: default_configuration,
               type: default_configuration,
               value: default_configuration)
  self.configured_aria = aria
  self.configured_classname = classname
  self.configured_data = data
  self.configured_id = id
  self.configured_name = name
  self.configured_label = label
  self.configured_placeholder = placeholder
  self.configured_type = type
  self.configured_value = value
end

Instance Method Details

#labelObject



36
37
38
39
40
41
42
# File 'app/pb_kits/playbook/pb_input/input.rb', line 36

def label
  if configured_label == default_configuration
    ""
  else
    configured_label
  end
end

#nameObject



44
45
46
47
48
49
50
# File 'app/pb_kits/playbook/pb_input/input.rb', line 44

def name
  if configured_name == default_configuration
    ""
  else
    configured_name
  end
end

#placeholderObject



52
53
54
55
56
57
58
# File 'app/pb_kits/playbook/pb_input/input.rb', line 52

def placeholder
  if configured_placeholder == default_configuration
    ""
  else
    configured_placeholder
  end
end

#to_partial_pathObject



76
77
78
# File 'app/pb_kits/playbook/pb_input/input.rb', line 76

def to_partial_path
  "pb_input/input"
end

#typeObject



60
61
62
63
64
65
66
# File 'app/pb_kits/playbook/pb_input/input.rb', line 60

def type
  if configured_type == default_configuration
    "text"
  else
    configured_type
  end
end

#valueObject



68
69
70
71
72
73
74
# File 'app/pb_kits/playbook/pb_input/input.rb', line 68

def value
  if configured_value == default_configuration
    ""
  else
    configured_value
  end
end