Class: PostType

Inherits:
Generable::Base show all
Defined in:
lib/aina/generable/types/post_type.rb

Constant Summary collapse

DEFAULT_SUPPORT =
'title,editor,excerpt,thumbnail'
DEFAULT_CAPABILITY =
'post'

Instance Attribute Summary collapse

Attributes inherited from Generable::Base

#aina_version, #file, #name, #template

Instance Method Summary collapse

Methods inherited from Generable::Base

#after_generate, #destroy, #dir, #generate, #initialize, #replacements

Methods included from Generable

accepts?, #after_generate, class_name_for, #dir, generable_types, #get_after_generate, #get_dir, #get_replacements, #get_template, #replacements, #template

Constructor Details

This class inherits a constructor from Generable::Base

Instance Attribute Details

#capabilityObject (readonly)

Returns the value of attribute capability.



2
3
4
# File 'lib/aina/generable/types/post_type.rb', line 2

def capability
  @capability
end

#name_capitalizeObject (readonly)

Returns the value of attribute name_capitalize.



2
3
4
# File 'lib/aina/generable/types/post_type.rb', line 2

def name_capitalize
  @name_capitalize
end

#supportsObject (readonly)

Returns the value of attribute supports.



2
3
4
# File 'lib/aina/generable/types/post_type.rb', line 2

def supports
  @supports
end

Instance Method Details

#get_capabilityObject



32
33
34
# File 'lib/aina/generable/types/post_type.rb', line 32

def get_capability
	@options[:c] ? @options[:c] : DEFAULT_CAPABILITY
end

#get_supportsObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/aina/generable/types/post_type.rb', line 21

def get_supports
	s = @options[:s] ? @options[:s] : DEFAULT_SUPPORT
	s = s.split(',')

	supports = Array.new
	s.each do |item|
		supports << "'#{item}'"
	end
	supports.join(',')
end

#set_custom_varsObject



13
14
15
16
17
18
19
# File 'lib/aina/generable/types/post_type.rb', line 13

def set_custom_vars
	@name_capitalize = self.name.capitalize
	if @options
		@supports = get_supports
		@capability = get_capability
	end
end