Class: Phlexing::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/phlexing/options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(component: false, component_name: "Component", parent_component: "Phlex::HTML", whitespace: true, svg_param: "s", template_name: "view_template") ⇒ Options

Returns a new instance of Options.



10
11
12
13
14
15
16
17
# File 'lib/phlexing/options.rb', line 10

def initialize(component: false, component_name: "Component", parent_component: "Phlex::HTML", whitespace: true, svg_param: "s", template_name: "view_template")
  @component = component
  @component_name = safe_constant_name(component_name)
  @parent_component = safe_constant_name(parent_component)
  @whitespace = whitespace
  @svg_param = svg_param
  @template_name = template_name
end

Instance Attribute Details

#componentObject Also known as: component?

Returns the value of attribute component.



5
6
7
# File 'lib/phlexing/options.rb', line 5

def component
  @component
end

#component_nameObject

Returns the value of attribute component_name.



5
6
7
# File 'lib/phlexing/options.rb', line 5

def component_name
  @component_name
end

#parent_componentObject

Returns the value of attribute parent_component.



5
6
7
# File 'lib/phlexing/options.rb', line 5

def parent_component
  @parent_component
end

#svg_paramObject

Returns the value of attribute svg_param.



5
6
7
# File 'lib/phlexing/options.rb', line 5

def svg_param
  @svg_param
end

#template_nameObject

Returns the value of attribute template_name.



5
6
7
# File 'lib/phlexing/options.rb', line 5

def template_name
  @template_name
end

#whitespaceObject Also known as: whitespace?

Returns the value of attribute whitespace.



5
6
7
# File 'lib/phlexing/options.rb', line 5

def whitespace
  @whitespace
end

Instance Method Details

#safe_constant_name(name) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/phlexing/options.rb', line 19

def safe_constant_name(name)
  name = name.to_s

  if name[0] == "0" || name[0].to_i != 0
    "A#{name}"
  else
    name
  end
end