Class: Attribeautiful::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/attribeautiful/attribute.rb,
lib/attribeautiful/attribute/name.rb,
lib/attribeautiful/attribute/value.rb

Defined Under Namespace

Classes: Name, Value

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Attribute

Returns a new instance of Attribute.



13
14
15
16
17
# File 'lib/attribeautiful/attribute.rb', line 13

def initialize(name)
  self.attr_name  = Attribeautiful::Attribute::Name.new(name)
  self.attr_value = Attribeautiful::Attribute::Value.new
  self
end

Instance Attribute Details

#attr_nameObject

Returns the value of attribute attr_name.



10
11
12
# File 'lib/attribeautiful/attribute.rb', line 10

def attr_name
  @attr_name
end

#attr_valueObject

Returns the value of attribute attr_value.



11
12
13
# File 'lib/attribeautiful/attribute.rb', line 11

def attr_value
  @attr_value
end

Instance Method Details

#add(*args) ⇒ Object



29
30
31
32
# File 'lib/attribeautiful/attribute.rb', line 29

def add(*args)
  self.attr_value.add(*args)
  self
end

#to_sObject



44
45
46
47
# File 'lib/attribeautiful/attribute.rb', line 44

def to_s
  return "" if attr_value.to_s.empty?
  return "#{attr_name}=\"#{attr_value}\"".html_safe
end

#use_dashesObject



24
25
26
27
# File 'lib/attribeautiful/attribute.rb', line 24

def use_dashes
  self.attr_name.use_dashes
  self
end

#use_semicolonsObject



39
40
41
42
# File 'lib/attribeautiful/attribute.rb', line 39

def use_semicolons
  self.attr_value.use_semicolons
  self
end

#use_spacesObject



34
35
36
37
# File 'lib/attribeautiful/attribute.rb', line 34

def use_spaces
  self.attr_value.use_spaces
  self
end

#use_underscoresObject



19
20
21
22
# File 'lib/attribeautiful/attribute.rb', line 19

def use_underscores
  self.attr_name.use_underscores
  self
end