Class: Phlex::Variants::OptionsBuilder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/phlex/variants.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Class Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

standard:disable Style/MissingRespondToMissing



139
140
141
142
143
144
145
146
147
148
149
# File 'lib/phlex/variants.rb', line 139

def method_missing(name, *args) # standard:disable Style/MissingRespondToMissing
  option = name.to_sym

  if option == :yes
    view_class::STYLE_VARIANTS[variant_name][true] = args
  elsif option == :no
    view_class::STYLE_VARIANTS[variant_name][false] = args
  else
    view_class::STYLE_VARIANTS[variant_name][option] = args
  end
end

Instance Attribute Details

#variant_nameObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



126
127
128
# File 'lib/phlex/variants.rb', line 126

def variant_name
  @variant_name
end

#view_classObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



126
127
128
# File 'lib/phlex/variants.rb', line 126

def view_class
  @view_class
end

Class Method Details

.build(view_class, variant_name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



128
129
130
# File 'lib/phlex/variants.rb', line 128

def self.build(view_class, variant_name, &)
  new(view_class, variant_name).instance_exec(&)
end