Class: Rocx::Properties::BaseProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/rocx/properties/base_property.rb

Direct Known Subclasses

ComplexProperty, ContainerProperty, Tab, ValueProperty

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.property_nameObject (readonly)

Returns the value of attribute property_name.



7
8
9
# File 'lib/rocx/properties/base_property.rb', line 7

def property_name
  @property_name
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/rocx/properties/base_property.rb', line 4

def value
  @value
end

Class Method Details

.name(*args) ⇒ Object



14
15
16
17
# File 'lib/rocx/properties/base_property.rb', line 14

def name(*args)
  @property_name = args.first if args.any?
  @name
end

.tag(*args) ⇒ Object



9
10
11
12
# File 'lib/rocx/properties/base_property.rb', line 9

def tag(*args)
  @tag = args.first if args.any?
  @tag
end

Instance Method Details

#default_nameObject



28
29
30
# File 'lib/rocx/properties/base_property.rb', line 28

def default_name
  class_name.gsub(/(.)([A-Z])/, '\1_\2').downcase
end

#default_tagObject



36
37
38
# File 'lib/rocx/properties/base_property.rb', line 36

def default_tag
  (class_name[0, 1].downcase + class_name[1..-1]).to_sym
end

#nameObject



24
25
26
# File 'lib/rocx/properties/base_property.rb', line 24

def name
  self.class.property_name || default_name
end

#render?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/rocx/properties/base_property.rb', line 20

def render?
  !value.nil?
end

#tagObject



32
33
34
# File 'lib/rocx/properties/base_property.rb', line 32

def tag
  self.class.tag || default_tag
end