Class: Url

Inherits:
ActiveRecord::Base show all
Extended by:
Assertions::ClassMethods
Includes:
Assertions, Examples
Defined in:
app/models/url.rb

Defined Under Namespace

Modules: Assertions, Examples

Constant Summary

Constants included from Examples

Examples::Test_url_record

Constants included from ColumnGroup::ClassMethods

ColumnGroup::ClassMethods::History_columns

Constants included from GenericGrep::ClassMethods

GenericGrep::ClassMethods::ASSOCIATION_MACRO_LETTERS, GenericGrep::ClassMethods::ASSOCIATION_MACRO_PATTERN

Constants included from GenericTableAssociation::Examples

GenericTableAssociation::Examples::First_stream_method

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Assertions::ClassMethods

assert_pre_conditions

Methods included from Assertions

#assert_pre_conditions

Methods included from GenericTableAssociation::ClassMethods

#associated_foreign_key_name, #association_arity, #association_class, #association_default_class_name?, #association_method_plurality, #association_method_symbol, #association_methods, #association_names, #association_names_to_many, #association_names_to_one, #association_patterns, #foreign_key_association_names, #foreign_key_names, #foreign_key_to_association_name, #is_association?, #is_association_patterns?, #is_association_to_many?, #is_association_to_one?, #is_foreign_key_name?, #is_matching_association?, #is_polymorphic_association?, #match_association_patterns?, #name_symbol

Methods included from Generic_Table::ClassMethods

#is_active_record_method?, #model_file_name, #nesting, #one_pass_statistics, #sample, #sample_burst

Methods included from ColumnGroup::ClassMethods

#attribute_ddl, #attribute_rails_type, #attribute_ruby_type, #candidate_logical_keys_from_indexes, #categorical?, #column_symbols, #default_logical_primary_key, #defaulted_primary_logical_key?, #history_type?, #is_logical_primary_key?, #logical_attributes, #logical_primary_key, #logical_primary_key_recursive, #numerical?, #probably_categorical?, #probably_numerical?, #sequential_id?

Methods included from GenericGrep::ClassMethods

#all_associations, #association_grep, #association_grep_pattern, #association_macro_type, #association_type, #belongs_to_association?, #grep_all_associations_command, #grep_command, #has_many_association?, #has_one_association?, #model_grep, #model_grep_command

Methods included from GenericTableHtml::ClassMethods

#column_order, #header_html, #table_html

Methods included from GenericTableAssociation

#associated_foreign_key_records, #associated_to_s, #association_class, #association_has_data, #association_state, #foreign_key_points_to_me?, #foreign_key_to_association, #foreign_key_value, #logical_primary_key_recursive_value, #logical_primary_key_value, #name_to_association

Methods included from GenericTableAssociation::Assertions::ClassMethods

#assert_foreign_keys_not_nil, #assert_invariant, #assert_post_conditions, #assert_pre_conditions

Methods included from GenericTableAssociation::Assertions

#assert_associated_foreign_key, #assert_associated_foreign_key_name, #assert_association, #assert_association_methods, #assert_association_to_many, #assert_association_to_one, #assert_foreign_key_association_names, #assert_foreign_key_name, #assert_foreign_key_not_nil, #assert_foreign_keys_not_nil, #assert_invariant, #assert_post_conditions, #assert_pre_conditions

Methods included from Generic_Table

activeRecordTableNotCreatedYet?, classDefiniton, classReference, class_of_name, eval_constant, is_ActiveRecord_table?, is_generic_table?, is_generic_table_name?, is_table?, rails_MVC_class?, rubyClassName, table_exists?

Methods included from GenericTableHtml

#column_html, #rails_route, #row_html

Class Method Details

.find_by_name(name) ⇒ Object

logical_primary_key


25
26
27
# File 'app/models/url.rb', line 25

def Url.find_by_name(name)
	Url.find_by_href(name)
end

.logical_primary_keyObject

init


22
23
24
# File 'app/models/url.rb', line 22

def self.logical_primary_key
	return [:href]	# logically the link name is the part that is visible and should be the unique name
end

Instance Method Details

stream_method


65
66
67
# File 'app/models/url.rb', line 65

def implicit_stream_link
	return StreamLink.new
end

#initObject


15
16
17
18
19
20
21
# File 'app/models/url.rb', line 15

def init
	if  self[:url].nil?
		@uri=nil
	else
		@uri=URI.parse(URI.escape(self[:url]))	
	end
end

#parsedURIObject

find_by_name


28
29
30
# File 'app/models/url.rb', line 28

def parsedURI
	return URI.split(URI.escape(self[:url]))
end

#schemeObject

def


57
58
59
# File 'app/models/url.rb', line 57

def scheme
	return @uri.scheme
end

#schemelessUrlObject

def


31
32
33
# File 'app/models/url.rb', line 31

def schemelessUrl
	return URI.unescape(URI.escape(self[:url]).split(':').last)
end

#stream_methodObject

scheme


60
61
62
63
64
# File 'app/models/url.rb', line 60

def stream_method
	scheme_name=scheme
	scheme_name=scheme_name[0..0].upcase+scheme_name[1..-1]
	return StreamMethod.find_by_name(scheme_name)
end

#uriArrayObject

end


42
43
44
# File 'app/models/url.rb', line 42

def uriArray
	return URI.split(URI.escape(self[:url]))
end

#uriComponent(componentName) ⇒ Object

schemelessUrl


34
35
36
37
38
39
40
41
# File 'app/models/url.rb', line 34

def uriComponent(componentName)
	ret=@uri.select(componentName)
	if ret.class==Array then
		return ret.class.name
	else
		return ret
	end
end

#uriHashObject

def


45
46
47
48
49
50
51
52
53
54
55
56
# File 'app/models/url.rb', line 45

def uriHash
	componentNames=@uri.class::COMPONENT
	hash={}
	componentNames.each_index do |i| 
		componentName= componentNames[i] 
		component=uriComponent(componentName)
		if !component[0].nil? then
			hash.merge!({ componentName => component })
		end #if
	end # each_index
	return hash
end